/* * Create a Best Effort Publication Topic to communicate the Lock Stat * Information * */ NDDS_ID createLockStatPub(NDDS_ID nddsId, char *topic) { int result; NDDS_ID pPubObj; char pubtopic[128]; /* Build Data type Object for both publication and subscription to Expproc */ /* ------- malloc space for data type object --------- */ if ( (pPubObj = (NDDS_ID) malloc( sizeof(NDDS_OBJ)) ) == NULL ) { return(NULL); } /* zero out structure */ memset(pPubObj,0,sizeof(NDDS_OBJ)); memcpy(pPubObj,nddsId,sizeof(NDDS_OBJ)); strcpy(pPubObj->topicName,topic); pPubObj->pubThreadId = 97; /* DEFAULT_PUB_THREADID; */ /* fills in dataTypeName, TypeRegisterFunc, TypeAllocFunc, TypeSizeFunc */ getLock_StatInfo(pPubObj); DPRINT1(-1,"createLockStatPub: topic: '%s' \n",pPubObj->topicName); #ifndef RTI_NDDS_4x createBEPublication(pPubObj); #else /* RTI_NDDS_4x */ initBEPublication(pPubObj); createPublication(pPubObj); #endif /* RTI_NDDS_4x */ return(pPubObj); }
/* * Create a Exception Publication to communicate with the Cntrollers/Master * * * Author Greg Brissey 8/18/05 * */ NDDS_ID createDDRSyncCommPub(NDDS_ID nddsId, char *topic, char *cntlrName) { int result; NDDS_ID pPubObj; char pubtopic[128]; Cntlr_Comm *issue; /* Build Data type Object for both publication and subscription to Expproc */ /* ------- malloc space for data type object --------- */ if ( (pPubObj = (NDDS_ID) malloc( sizeof(NDDS_OBJ)) ) == NULL ) { return(NULL); } /* create the pub issue Mutual Exclusion semaphore */ pDDRSyncPubMutex = semMCreate(SEM_Q_PRIORITY | SEM_INVERSION_SAFE | SEM_DELETE_SAFE); /* zero out structure */ memset(pPubObj,0,sizeof(NDDS_OBJ)); memcpy(pPubObj,nddsId,sizeof(NDDS_OBJ)); strcpy(pPubObj->topicName,topic); pPubObj->pubThreadId = 0xbadc0de; /* DEFAULT_PUB_THREADID; taskIdSelf(); */ /* fills in dataTypeName, TypeRegisterFunc, TypeAllocFunc, TypeSizeFunc */ getCntlr_CommInfo(pPubObj); DPRINT2(+1,"Create Pub topic: '%s' for Cntlr: '%s'\n",pPubObj->topicName,cntlrName); createPublication(pPubObj); issue = (Cntlr_Comm *) pPubObj->instance; strcpy(issue->cntlrId,cntlrName); /* fill in the constant cntlrId string */ return(pPubObj); }
/* * Create a Publication Topic to communicate with the Lock * * Author Greg Brissey 5-06-04 */ NDDS_ID createLockCmdPub(NDDS_ID nddsId, char *topic, char *cntlrName) { int result; NDDS_ID pPubObj; char pubtopic[128]; Lock_Cmd *issue; /* Build Data type Object for both publication and subscription to Expproc */ /* ------- malloc space for data type object --------- */ if ( (pPubObj = (NDDS_ID) malloc( sizeof(NDDS_OBJ)) ) == NULL ) { return(NULL); } /* zero out structure */ memset(pPubObj,0,sizeof(NDDS_OBJ)); memcpy(pPubObj,nddsId,sizeof(NDDS_OBJ)); strcpy(pPubObj->topicName,topic); pPubObj->pubThreadId = 89; /* DEFAULT_PUB_THREADID; */ /* fills in dataTypeName, TypeRegisterFunc, TypeAllocFunc, TypeSizeFunc */ getLock_CmdInfo(pPubObj); DPRINT2(-1,"Create Pub topic: '%s' for Cntlr: '%s'\n",pPubObj->topicName,cntlrName); createPublication(pPubObj); issue = (Lock_Cmd *) pPubObj->instance; return(pPubObj); }
bool Streams::subscribe(Peer& peer,UInt32 id,const string& name,FlowWriter& writer,double start) { Publications::Iterator it = createPublication(name); Publication& publication(*it->second); bool result = publication.addListener(peer,id,writer,start==-3000 ? true : false); if(!result && publication.publisherId()==0 && publication.listeners.count()==0) destroyPublication(it); return result; }
Listener& Streams::subscribe(Peer& peer,UInt32 id,const string& name,FlowWriter& writer,double start) { Publications::Iterator it = createPublication(name); Publication& publication(*it->second); try { return publication.addListener(peer,id,writer,start==-3000 ? true : false); } catch(...) { if(publication.publisherId()==0 && publication.listeners.count()==0) destroyPublication(it); throw; } }
Publication& Streams::publish(Peer& peer,UInt32 id,const string& name,FlowWriter* pController) { Publications::Iterator it = createPublication(name); Publication& publication(*it->second); try { publication.start(peer,id,pController); } catch(...) { if(publication.publisherId()==0 && publication.listeners.count()==0) destroyPublication(it); throw; } return publication; }
/* * Create a Best Effort Publication Topic to communicate the Lock Status * Information * * Author Greg Brissey 9-29-04 */ NDDS_ID createFidCtStatusPub(NDDS_ID nddsId, char *topic) { int result; NDDS_ID pPubObj; char pubtopic[128]; /* Build Data type Object for both publication and subscription to Expproc */ /* ------- malloc space for data type object --------- */ if ( (pPubObj = (NDDS_ID) malloc( sizeof(NDDS_OBJ)) ) == NULL ) { return(NULL); } /* zero out structure */ memset(pPubObj,0,sizeof(NDDS_OBJ)); memcpy(pPubObj,nddsId,sizeof(NDDS_OBJ)); strcpy(pPubObj->topicName,topic); pPubObj->pubThreadId = STATMON_TASK_PRIORITY; /* DEFAULT_PUB_THREADID; taskIdSelf(); */ /* fills in dataTypeName, TypeRegisterFunc, TypeAllocFunc, TypeSizeFunc */ getFidCt_StatInfo(pPubObj); /* added this so for muliple DDRs the strength is different for all DDRs * DDR1 =1, DDR2 = 2, etc. */ pPubObj->publisherStrength = 1024 - BrdNum; DPRINT2(1,"createFidCtStatusPub: Create Pub topic: '%s', strenght: %d \n", pPubObj->topicName,pPubObj->publisherStrength); #ifndef RTI_NDDS_4x createBEPublication(pPubObj); #else /* RTI_NDDS_4x */ initBEPublication(pPubObj); createPublication(pPubObj); #endif /* RTI_NDDS_4x */ return(pPubObj); }
NDDS_ID createMonitorCmdsPub(char *pubName) { int result; NDDS_ID pPubObj; /* Build Data type Object for both publication and subscription to Expproc */ /* ------- malloc space for data type object --------- */ if ( (pPubObj = (NDDS_ID) malloc( sizeof(NDDS_OBJ)) ) == NULL ) { return(NULL); } /* zero out structure */ memset(pPubObj,0,sizeof(NDDS_OBJ)); memcpy(pPubObj,NDDS_Domain,sizeof(NDDS_OBJ)); strcpy(pPubObj->topicName,pubName); /* fills in dataTypeName, TypeRegisterFunc, TypeAllocFunc, TypeSizeFunc */ getMonitor_CmdInfo(pPubObj); pPubObj->queueSize = 10; pPubObj->highWaterMark = 1; pPubObj->lowWaterMark = 0; pPubObj->AckRequestsPerSendQueue = 10; pPubObj->pubThreadId = 1; /* for mulit threaded apps */ #ifndef RTI_NDDS_4x pPubObj->pubRelStatRtn = Monitor_CmdsPubStatusRtn; /* pPubObj->pubRelStatParam = (void*) pCntlrThr; */ pPubObj->pubRelStatParam = (void*) NULL; #endif /* RTI_NDDS_4x */ #ifdef RTI_NDDS_4x initPublication(pPubObj); #endif /* RTI_NDDS_4x */ createPublication(pPubObj); return(pPubObj); }