UpdateDataTypes.h

Go to the documentation of this file.
00001 /*
00002  *
00003  *
00004  * Distributed under the OpenDDS License.
00005  * See: http://www.opendds.org/license.html
00006  */
00007 
00008 #ifndef UPDATE_DATA_TYPES
00009 #define UPDATE_DATA_TYPES
00010 
00011 #include "dds/DdsDcpsInfoUtilsC.h"
00012 #include "dds/DdsDcpsInfrastructureC.h"
00013 
00014 #include <vector>
00015 #include <string>
00016 
00017 namespace Update {
00018 
00019 enum ItemType  { Topic, Participant, Actor };
00020 enum ActorType { DataReader, DataWriter };
00021 enum SpecificQos {
00022   NoQos,
00023   ParticipantQos,
00024   TopicQos,
00025   DataWriterQos,
00026   PublisherQos,
00027   DataReaderQos,
00028   SubscriberQos
00029 };
00030 
00031 typedef long                            DomainIdType;
00032 typedef OpenDDS::DCPS::RepoId           IdType; // Federation scope identifier type.
00033 typedef std::pair <size_t, char*>       BinSeq;
00034 typedef std::pair <SpecificQos, BinSeq> QosSeq;
00035 
00036 struct IdPath {
00037   DomainIdType domain;
00038   IdType       participant;
00039   IdType       id;
00040 
00041   IdPath(DomainIdType d, IdType p, IdType i)
00042   : domain(d),
00043       participant(p),
00044       id(i) { }
00045 };
00046 
00047 struct OwnershipData {
00048   DomainIdType domain;
00049   IdType       participant;
00050   long         owner;
00051 
00052   OwnershipData(DomainIdType d, IdType p, long o)
00053   : domain(d),
00054       participant(p),
00055       owner(o) { }
00056 };
00057 
00058 template <typename Q, typename S>
00059 struct TopicStrt {
00060   DomainIdType domainId;
00061   IdType       topicId;
00062   IdType       participantId;
00063   S            name;
00064   S            dataType;
00065   Q            topicQos;
00066 
00067   TopicStrt(
00068     DomainIdType dom,
00069     IdType       to,
00070     IdType       pa,
00071     const char*  na,
00072     const char*  da,
00073     Q            tQos) : domainId(dom),
00074       topicId(to),
00075       participantId(pa),
00076       name(na),
00077       dataType(da),
00078       topicQos(tQos) { };
00079 };
00080 typedef struct TopicStrt<DDS::TopicQos&, std::string> UTopic;
00081 typedef struct TopicStrt<QosSeq, std::string>         DTopic;
00082 
00083 template <typename Q>
00084 struct ParticipantStrt {
00085   DomainIdType domainId;
00086   long         owner;
00087   IdType       participantId;
00088   Q            participantQos;
00089 
00090   ParticipantStrt(
00091     DomainIdType dom,
00092     long         own,
00093     IdType       part,
00094     Q            pQos) : domainId(dom),
00095       owner(own),
00096       participantId(part),
00097       participantQos(pQos) { };
00098 };
00099 typedef struct ParticipantStrt<DDS::DomainParticipantQos&> UParticipant;
00100 typedef struct ParticipantStrt<QosSeq>                     DParticipant;
00101 
00102 struct ContentSubscriptionInfo {
00103   CORBA::String_var filterClassName;
00104   CORBA::String_var filterExpr;
00105   DDS::StringSeq exprParams;
00106 
00107   ContentSubscriptionInfo() {}
00108   ContentSubscriptionInfo(const char* fcn, const char* fx, const DDS::StringSeq& ep)
00109     : filterClassName(fcn), filterExpr(fx), exprParams(ep) {}
00110 };
00111 
00112 // like std::pair but with names instead of "first" and "second", since the
00113 // exprParams attribute is itself a std::pair and naming is too confusing with
00114 // nested pairs.
00115 struct ContentSubscriptionBin {
00116   ACE_CString filterClassName;
00117   ACE_CString filterExpr;
00118   BinSeq exprParams;
00119 };
00120 
00121 template <typename PSQ, typename RWQ, typename C, typename T, typename CSP>
00122 struct ActorStrt {
00123   DomainIdType domainId;
00124   IdType       actorId;
00125   IdType       topicId;
00126   IdType       participantId;
00127   ActorType    type;
00128   C            callback;
00129   PSQ          pubsubQos;
00130   RWQ          drdwQos;
00131   T            transportInterfaceInfo;
00132   CSP          contentSubscriptionProfile;
00133 
00134   ActorStrt(
00135     DomainIdType dom,
00136     IdType       act,
00137     IdType       top,
00138     IdType       part,
00139     ActorType    typ,
00140     const char*  call,
00141     PSQ          pub,
00142     RWQ          drdw,
00143     T            trans,
00144     CSP          csProf)
00145     : domainId(dom),
00146       actorId(act),
00147       topicId(top),
00148       participantId(part),
00149       type(typ),
00150       callback(call),
00151       pubsubQos(pub),
00152       drdwQos(drdw),
00153       transportInterfaceInfo(trans),
00154       contentSubscriptionProfile(csProf)
00155     { };
00156 };
00157 typedef struct ActorStrt<
00158       DDS::SubscriberQos&,
00159       DDS::DataReaderQos&,
00160       std::string,
00161       OpenDDS::DCPS::TransportLocatorSeq&,
00162       ContentSubscriptionInfo&> URActor;
00163 typedef struct ActorStrt<
00164       DDS::PublisherQos&,
00165       DDS::DataWriterQos&,
00166       std::string,
00167       OpenDDS::DCPS::TransportLocatorSeq&,
00168       ContentSubscriptionInfo&> UWActor;
00169 typedef struct ActorStrt<QosSeq, QosSeq, std::string,
00170                          BinSeq, ContentSubscriptionBin> DActor;
00171 
00172 template <typename T, typename P, typename A, typename W>
00173 struct ImageData {
00174   typedef std::vector<T> TopicSeq;
00175   typedef std::vector<P> ParticipantSeq;
00176   typedef std::vector<A> ReaderSeq;
00177   typedef std::vector<W> WriterSeq;
00178 
00179   unsigned long  sequenceNumber;
00180   TopicSeq       topics;
00181   ParticipantSeq participants;
00182   ReaderSeq      actors;
00183   WriterSeq      wActors;
00184 };
00185 typedef struct ImageData<UTopic*, UParticipant*, URActor*, UWActor*> UImage;
00186 typedef struct ImageData<DTopic,  DParticipant,  DActor,   DActor>   DImage;
00187 
00188 } // namespace Update
00189 
00190 #endif /* UPDATE_DATA_TYPES */

Generated on Fri Feb 12 20:05:29 2016 for OpenDDS by  doxygen 1.4.7