Changeset 11881 for trunk/FACT++/dim/src
- Timestamp:
- 08/11/11 16:35:28 (13 years ago)
- Location:
- trunk/FACT++/dim/src
- Files:
-
- 5 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/FACT++/dim/src/diccpp.cxx
r11695 r11881 110 110 { 111 111 char *def; 112 int len = 0, new_len; 112 113 113 114 if(itsFormat) 114 115 { 115 return itsFormat; 116 len = strlen(itsFormat)+1; 117 if(len > 1) 118 return itsFormat; 116 119 } 117 120 def = dic_get_format(itsId); 118 119 itsFormat = new char[strlen(def)+1]; 121 new_len = strlen(def)+1; 122 if(new_len > len) 123 { 124 if(itsFormat) 125 delete[] itsFormat; 126 itsFormat = new char[strlen(def)+1]; 127 } 120 128 strcpy(itsFormat, def); 121 129 return itsFormat; -
trunk/FACT++/dim/src/dis.c
r11121 r11881 1015 1015 { 1016 1016 dnsp->updating_service_list = 0; 1017 dis_update_service(dnsp->dis_service_id); 1017 if(dnsp->dis_service_id) 1018 dis_update_service(dnsp->dis_service_id); 1018 1019 } 1019 1020 -
trunk/FACT++/dim/src/examples/test_client.c
r11121 r11881 64 64 int *tag, *size; 65 65 { 66 char *format; 66 67 68 format = dic_get_format(0); 69 printf("Received format = %s %08x, %d\n",format, format, *size); 67 70 if(*tag == 1100) 68 71 { … … 91 94 } 92 95 else 93 printf("%s Received %s for Service%03d\n",client_str,buf,*tag);96 printf("%s Received %s %08X for Service%03d\n",client_str,buf, buf,*tag); 94 97 95 98 /* … … 121 124 { 122 125 sprintf(str,"%s/Service_%03d",argv[2],i); 126 // dic_info_service( str, TIMED, 10, 0, 0, rout, i, 127 // "No Link", 8 ); 123 128 dic_info_service( str, TIMED, 10, 0, 0, rout, i, 124 "No Link", 8);129 NULL, 0 ); 125 130 } 126 131 -
trunk/FACT++/dim/src/examples/test_client.cxx
r11695 r11881 30 30 int index = 0; 31 31 char **services; 32 char *format; 32 33 // cout << "Dns Node = " << DimClient::getDnsNode() << endl; 33 cout << "Received STRVAL : " << getString() << endl; 34 format = getFormat(); 35 cout << "Received STRVAL : " << getString() << "format = " << format << endl; 34 36 services = DimClient::getServerServices(); 35 37 cout<< "from "<< DimClient::getServerName() << " services:" << endl; -
trunk/FACT++/dim/src/examples/test_server.cxx
r11695 r11881 1 //============================================================================ 2 // Name : emptyDimFormat.cpp 3 // Author : Etienne Lyard etienne.lyard@unige.ch 4 // Version : 00 5 // Copyright : 6 // Description : Demonstrates the occurence of an empty Dim format from the client's perspective 7 //============================================================================ 8 /* 9 #include <dic.hxx> 10 #include <dis.hxx> 11 #include <iostream> 12 using namespace std; 13 14 class EmptyServiceSubscriber : public DimInfo 15 { 16 DimStampedInfo* info; 17 int noLink; 18 public: 19 EmptyServiceSubscriber() 20 { 21 // info = new DimStampedInfo("TIME/EMPTY", const_cast<char*>(""), this); 22 noLink = -1; 23 info = new DimStampedInfo("TIME/EMPTY", noLink, this); 24 } 25 void infoHandler() 26 { 27 DimInfo* I = getInfo(); 28 int data; 29 if (I == info) 30 { 31 data = I->getInt(); 32 // cout << "EMPTY SERVICE UPDATED. " << "Format: " << I->getFormat() << endl; 33 cout << "EMPTY SERVICE UPDATED. " << data << " Format: " << I->getFormat() << endl; 34 } 35 } 36 }; 37 38 int main(int, const char**) 39 { 40 DimServer::start("TIME"); 41 42 int emptyFormatVariable = 0; 43 DimService* emptyFormatService = new DimService("TIME/EMPTY", "I:1", &emptyFormatVariable, sizeof(long)); 44 EmptyServiceSubscriber mySubscriber; 45 //The three lines below create (most of the time) an empty format on the client side. 46 //We must be able to deal with such cases in our framework because services can be stopped and re-spawned at any time 47 delete emptyFormatService; 48 usleep(1000000); 49 emptyFormatService = new DimService("TIME/EMPTY", "I:1", &emptyFormatVariable, sizeof(long)); 50 51 while (1) 52 { 53 emptyFormatService->updateService(); 54 usleep(1000000); 55 } 56 57 return 0; 58 } 59 */ 60 1 61 #include <iostream> 2 62 #include <dis.hxx>
Note:
See TracChangeset
for help on using the changeset viewer.