Ignore:
Timestamp:
08/11/11 16:35:28 (13 years ago)
Author:
tbretz
Message:
Updated to DIM V19r24
File:
1 edited

Legend:

Unmodified
Added
Removed
  • 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>
     12using namespace std;
     13
     14class EmptyServiceSubscriber : public DimInfo
     15{
     16    DimStampedInfo* info;
     17        int noLink;
     18public:
     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
     38int 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
    161#include <iostream>
    262#include <dis.hxx>
Note: See TracChangeset for help on using the changeset viewer.