Cpp Client, with Makefile

The following Cpp examples shows how a timer and a counter are opeated. Below you find the corresponding Makefile.

#include <tango.h>
using namespace Tango;

main(unsigned int argc, char **argv)
{
  long temp; 
  DeviceData devdata; 

  DeviceProxy *timer = new DeviceProxy( "hires/exp/t1");
  DeviceProxy *counter = new DeviceProxy( "hires/exp/c1");
  
  DeviceAttribute *da = new DeviceAttribute( "SampleTime", (double) 3.5); 
  timer->write_attribute( *da);   
  
  cout << " starting timer with 3.5s " << endl; 
  timer->command_inout( "Start"); 
  devdata = counter->command_inout( "Reset"); 
  devdata = timer->command_inout( "Check"); 
  devdata >> temp; 
  while( temp)
    {
      *da = counter->read_attribute( "Counts"); 
      *da >> temp;
      cout << " read-counter  returns " << temp << endl; 
      devdata = timer->command_inout( "Check"); 
      devdata >> temp; 
      sleep(1); 
    }
}

Here is the Makefile:

CC = g++
TANGO_HOME = /usr/local

INCLUDE_DIRS = -I $(TANGO_HOME)/include -I .

LIB_DIRS = -L $(TANGO_HOME)/lib

CXXFLAGS =  -D_REENTRANT $(INCLUDE_DIRS)
LFLAGS =  $(LIB_DIRS) -ltango \
                      -llog4tango \
                      -lomniORB4 \
                      -lomniDynamic4 \
                      -lCOS4 \
                      -lomnithread \
                      -lpthread

.SUFFIXES:      .o .cpp
.cpp.o:
	$(CC) $(CXXFLAGS) -c $<
                                
V260Test:   V260Test.o
	$(CC) V260Test.o -o V260Test $(LFLAGS)

clean:
	rm -f *.o core