Commit 6fafdc29 authored by Marco De Marco's avatar Marco De Marco
Browse files

Initial import

parents
Loading
Loading
Loading
Loading

Makefile

0 → 100644
+110 −0
Original line number Diff line number Diff line
#================================================================================
EXEC_NAME=dataImporter-srv
INST_NAME=test
DEBUG_LEV=-v3
INSTALL_DIR=/usr/local/bin
#================================================================================
INC_DIR=/usr/local/omniORB-4.1.7/include \
	   /usr/local/zeromq-3.2.3/include/zmq \
	   /usr/local/tango-8.1.2/include/tango \
	   /usr/local/soci-3.2.1/include \
	   /usr/local/soci-3.2.1/include/soci \
	   /usr/include/mysql \
	   /usr/local/protobuf-2.5.0/include \
	   ./src
LIB_DIR=/usr/local/omniORB-4.1.7/lib \
	   /usr/local/zeromq-3.2.3/lib \
	   /usr/local/tango-8.1.2/lib \
	   /usr/local/soci-3.2.1/lib64 \
	   /usr/local/protobuf-2.5.0/lib
#================================================================================
CC=g++
CXX_DEBUG_FLAGS=-g -DVERBOSE_DEBUG
CXX_RELEASE_FLAGS=-O3
CXX_DEFAULT_FLAGS=-c -Wall -Wextra -std=c++11 -std=gnu++11
LDFLAGS=-Wall -lomniORB4 -lomniDynamic4 -lCOS4 -lomnithread -ltango -llog4tango \
	-lsoci_core -lsoci_mysql -lboost_system -lboost_thread -lboost_filesystem \
	-lboost_date_time -lprotobuf -lssl
INC_PARM=$(foreach d, $(INC_DIR), -I$d)
LIB_PARM=$(foreach d, $(LIB_DIR), -L$d)
PROTOC :=/usr/local/protobuf-2.5.0/bin/protoc
#================================================================================
SRC_DIR=./src
OBJ_DIR=./obj
BIN_DIR=./bin
PROTO_DIR=./proto
#================================================================================
EXECUTABLE := $(BIN_DIR)/$(EXEC_NAME)
CPP_FILES := $(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES := $(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.o)))
#================================================================================
PROTO_FILES := $(wildcard $(PROTO_DIR)/*.proto)
PROTO_HEADERS := $(addprefix $(SRC_DIR)/,$(notdir $(PROTO_FILES:.proto=.pb.h)))
PROTO_CLASSES := $(addprefix $(SRC_DIR)/,$(notdir $(PROTO_FILES:.proto=.pb.cc)))
CPP_FILES += $(PROTO_CLASSES)
OBJ_FILES += $(addprefix $(OBJ_DIR)/,$(notdir $(PROTO_CLASSES:.pb.cc=.pb.o)))
#================================================================================

.PHONY: all
all: debug

.PHONY: run
run: debug
	$(EXECUTABLE) $(INST_NAME) $(DEBUG_LEV)

.PHONY: release
release: CXXFLAGS+=$(CXX_RELEASE_FLAGS) $(CXX_DEFAULT_FLAGS)
release: $(EXECUTABLE)

.PHONY: debug
debug: CXXFLAGS+=$(CXX_DEBUG_FLAGS) $(CXX_DEFAULT_FLAGS)
debug: $(EXECUTABLE)

$(EXECUTABLE): makedir $(OBJ_FILES)
	$(CC) $(LDFLAGS) $(LIB_PARM) -o $@ $(OBJ_FILES)

$(OBJ_DIR)/%.o: $(SRC_DIR)/%.cpp
	$(CC) $(CXXFLAGS) $(INC_PARM) -o $@ $<

$(OBJ_DIR)/%.pb.o: $(SRC_DIR)/%.pb.cc
	$(CC) $(CXXFLAGS) $(INC_PARM) -o $@ $<

.PHONY: protoc
protoc:
	$(PROTOC) --proto_path=$(PROTO_DIR) --cpp_out=$(SRC_DIR) $(PROTO_FILES)

.PHONY: makedir
makedir:
	-mkdir -p $(OBJ_DIR) $(BIN_DIR)

.PHONY: clean
clean:
	-rm -rf $(OBJ_DIR) $(BIN_DIR)

.PHONY: deepclean
deepclean:
	-rm -rf $(OBJ_DIR) $(BIN_DIR) $(PROTO_HEADERS) $(PROTO_CLASSES)

.PHONY: install
install:
	-cp $(EXECUTABLE) $(INSTALL_DIR)

.PHONY: echo
echo:
	@echo EXECUTABLE:
	@echo $(EXECUTABLE)
	@echo CPP FILES:
	@echo $(CPP_FILES)
	@echo OBJ_FILES:
	@echo $(OBJ_FILES)
	@echo INC_PARM
	@echo $(INC_PARM)
	@echo LIB_PARM
	@echo $(LIB_PARM)
	@echo PROTO_FILES
	@echo $(PROTO_FILES)
	@echo PROTO_CLASSES
	@echo $(PROTO_CLASSES)
	@echo PROTO_HEADERS
	@echo $(PROTO_HEADERS)

src/ClassFactory.cpp

0 → 100644
+56 −0
Original line number Diff line number Diff line
/*----- PROTECTED REGION ID(DataImporter::ClassFactory.cpp) ENABLED START -----*/
static const char *RcsId = "$Id:  $";
//=============================================================================
//
// file :        ClassFactory.cpp
//
// description : C++ source for the class_factory method of the DServer
//               device class. This method is responsible for the creation of
//               all class singleton for a device server. It is called
//               at device server startup.
//
// project :     Data importer
//
// This file is part of Tango device class.
// 
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Tango.  If not, see <http://www.gnu.org/licenses/>.
// 
// $Author:  $
//
// $Revision:  $
// $Date:  $
//
// $HeadURL:  $
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================

#include <tango.h>
#include <DataImporterClass.h>

//	Add class header files if needed


/**
 *	Create DataImporter Class singleton and store it in DServer object.
 */

void Tango::DServer::class_factory()
{
	//	Add method class init if needed
	add_class(DataImporter_ns::DataImporterClass::init("DataImporter"));
}
/*----- PROTECTED REGION END -----*/	//	DataImporter::ClassFactory.cpp

src/DataImporter.cpp

0 → 100644
+207 −0
Original line number Diff line number Diff line
/*----- PROTECTED REGION ID(DataImporter.cpp) ENABLED START -----*/
static const char *RcsId = "$Id:  $";
//=============================================================================
//
// file :        DataImporter.cpp
//
// description : C++ source for the DataImporter class and its commands.
//               The class is derived from Device. It represents the
//               CORBA servant object which will be accessed from the
//               network. All commands which can be executed on the
//               DataImporter are implemented in this file.
//
// project :     Data importer
//
// This file is part of Tango device class.
// 
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Tango.  If not, see <http://www.gnu.org/licenses/>.
// 
// $Author:  $
//
// $Revision:  $
// $Date:  $
//
// $HeadURL:  $
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================


#include <DataImporter.h>
#include <DataImporterClass.h>

/*----- PROTECTED REGION END -----*/	//	DataImporter.cpp

/**
 *  DataImporter class description:
 *    
 */

//================================================================
//  The following table gives the correspondence
//  between command and method names.
//
//  Command name  |  Method name
//================================================================
//  State         |  Inherited (no method)
//  Status        |  Inherited (no method)
//================================================================

//================================================================
//  Attributes managed is:
//================================================================
//================================================================

namespace DataImporter_ns
{
/*----- PROTECTED REGION ID(DataImporter::namespace_starting) ENABLED START -----*/

//	static initializations

/*----- PROTECTED REGION END -----*/	//	DataImporter::namespace_starting

//--------------------------------------------------------
/**
 *	Method      : DataImporter::DataImporter()
 *	Description : Constructors for a Tango device
 *                implementing the classDataImporter
 */
//--------------------------------------------------------
DataImporter::DataImporter(Tango::DeviceClass *cl, string &s)
 : TANGO_BASE_CLASS(cl, s.c_str())
{
	/*----- PROTECTED REGION ID(DataImporter::constructor_1) ENABLED START -----*/
	init_device();
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::constructor_1
}
//--------------------------------------------------------
DataImporter::DataImporter(Tango::DeviceClass *cl, const char *s)
 : TANGO_BASE_CLASS(cl, s)
{
	/*----- PROTECTED REGION ID(DataImporter::constructor_2) ENABLED START -----*/
	init_device();
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::constructor_2
}
//--------------------------------------------------------
DataImporter::DataImporter(Tango::DeviceClass *cl, const char *s, const char *d)
 : TANGO_BASE_CLASS(cl, s, d)
{
	/*----- PROTECTED REGION ID(DataImporter::constructor_3) ENABLED START -----*/
	init_device();
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::constructor_3
}

//--------------------------------------------------------
/**
 *	Method      : DataImporter::delete_device()
 *	Description : will be called at device destruction or at init command
 */
//--------------------------------------------------------
void DataImporter::delete_device()
{
	DEBUG_STREAM << "DataImporter::delete_device() " << device_name << endl;
	/*----- PROTECTED REGION ID(DataImporter::delete_device) ENABLED START -----*/
	
	//	Delete device allocated objects
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::delete_device
}

//--------------------------------------------------------
/**
 *	Method      : DataImporter::init_device()
 *	Description : will be called at device initialization.
 */
//--------------------------------------------------------
void DataImporter::init_device()
{
	DEBUG_STREAM << "DataImporter::init_device() create device " << device_name << endl;
	/*----- PROTECTED REGION ID(DataImporter::init_device_before) ENABLED START -----*/
	
	//	Initialization before get_device_property() call
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::init_device_before
	
	//	No device property to be read from database
	

	/*----- PROTECTED REGION ID(DataImporter::init_device) ENABLED START -----*/
	
	//	Initialize device
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::init_device
}


//--------------------------------------------------------
/**
 *	Method      : DataImporter::always_executed_hook()
 *	Description : method always executed before any command is executed
 */
//--------------------------------------------------------
void DataImporter::always_executed_hook()
{
	INFO_STREAM << "DataImporter::always_executed_hook()  " << device_name << endl;
	/*----- PROTECTED REGION ID(DataImporter::always_executed_hook) ENABLED START -----*/
	
	//	code always executed before all requests
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::always_executed_hook
}

//--------------------------------------------------------
/**
 *	Method      : DataImporter::read_attr_hardware()
 *	Description : Hardware acquisition for attributes
 */
//--------------------------------------------------------
void DataImporter::read_attr_hardware(TANGO_UNUSED(vector<long> &attr_list))
{
	DEBUG_STREAM << "DataImporter::read_attr_hardware(vector<long> &attr_list) entering... " << endl;
	/*----- PROTECTED REGION ID(DataImporter::read_attr_hardware) ENABLED START -----*/
	
	//	Add your own code
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::read_attr_hardware
}


//--------------------------------------------------------
/**
 *	Method      : DataImporter::add_dynamic_attributes()
 *	Description : Create the dynamic attributes if any
 *                for specified device.
 */
//--------------------------------------------------------
void DataImporter::add_dynamic_attributes()
{
	/*----- PROTECTED REGION ID(DataImporter::add_dynamic_attributes) ENABLED START -----*/
	
	//	Add your own code to create and add dynamic attributes if any
	
	/*----- PROTECTED REGION END -----*/	//	DataImporter::add_dynamic_attributes
}


/*----- PROTECTED REGION ID(DataImporter::namespace_ending) ENABLED START -----*/

//	Additional Methods

/*----- PROTECTED REGION END -----*/	//	DataImporter::namespace_ending
} //	namespace

src/DataImporter.h

0 → 100644
+156 −0
Original line number Diff line number Diff line
/*----- PROTECTED REGION ID(DataImporter.h) ENABLED START -----*/
//=============================================================================
//
// file :        DataImporter.h
//
// description : Include file for the DataImporter class
//
// project :     Data importer
//
// This file is part of Tango device class.
// 
// Tango is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.
// 
// Tango is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
// 
// You should have received a copy of the GNU General Public License
// along with Tango.  If not, see <http://www.gnu.org/licenses/>.
// 
// $Author:  $
//
// $Revision:  $
// $Date:  $
//
// $HeadURL:  $
//
//=============================================================================
//                This file is generated by POGO
//        (Program Obviously used to Generate tango Object)
//=============================================================================


#ifndef DataImporter_H
#define DataImporter_H

#include <tango.h>


/*----- PROTECTED REGION END -----*/	//	DataImporter.h

/**
 *  DataImporter class description:
 *    
 */

namespace DataImporter_ns
{
/*----- PROTECTED REGION ID(DataImporter::Additional Class Declarations) ENABLED START -----*/

//	Additional Class Declarations

/*----- PROTECTED REGION END -----*/	//	DataImporter::Additional Class Declarations

class DataImporter : public TANGO_BASE_CLASS
{

/*----- PROTECTED REGION ID(DataImporter::Data Members) ENABLED START -----*/

//	Add your own data members

/*----- PROTECTED REGION END -----*/	//	DataImporter::Data Members



//	Constructors and destructors
public:
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	DataImporter(Tango::DeviceClass *cl,string &s);
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	DataImporter(Tango::DeviceClass *cl,const char *s);
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device name
	 *	@param d	Device description.
	 */
	DataImporter(Tango::DeviceClass *cl,const char *s,const char *d);
	/**
	 * The device object destructor.
	 */	
	~DataImporter() {delete_device();};


//	Miscellaneous methods
public:
	/*
	 *	will be called at device destruction or at init command.
	 */
	void delete_device();
	/*
	 *	Initialize the device
	 */
	virtual void init_device();
	/*
	 *	Always executed method before execution command method.
	 */
	virtual void always_executed_hook();


//	Attribute methods
public:
	//--------------------------------------------------------
	/*
	 *	Method      : DataImporter::read_attr_hardware()
	 *	Description : Hardware acquisition for attributes.
	 */
	//--------------------------------------------------------
	virtual void read_attr_hardware(vector<long> &attr_list);


	//--------------------------------------------------------
	/**
	 *	Method      : DataImporter::add_dynamic_attributes()
	 *	Description : Add dynamic attributes if any.
	 */
	//--------------------------------------------------------
	void add_dynamic_attributes();



//	Command related methods
public:


/*----- PROTECTED REGION ID(DataImporter::Additional Method prototypes) ENABLED START -----*/

//	Additional Method prototypes

/*----- PROTECTED REGION END -----*/	//	DataImporter::Additional Method prototypes
};

/*----- PROTECTED REGION ID(DataImporter::Additional Classes Definitions) ENABLED START -----*/

//	Additional Classes Definitions

/*----- PROTECTED REGION END -----*/	//	DataImporter::Additional Classes Definitions

}	//	End of namespace

#endif   //	DataImporter_H

src/DataImporter.xmi

0 → 100644
+28 −0
Original line number Diff line number Diff line
<?xml version="1.0" encoding="ASCII"?>
<pogoDsl:PogoSystem xmi:version="2.0" xmlns:xmi="http://www.omg.org/XMI" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:pogoDsl="http://www.esrf.fr/tango/pogo/PogoDsl">
  <classes name="DataImporter" pogoRevision="8.1">
    <description description="" title="Data importer" sourcePath="/home/mdm/workspace/nadir/data_importer/src" language="Cpp" filestogenerate="XMI   file,Code files" license="GPL" hasMandatoryProperty="false" hasConcreteProperty="false" hasAbstractCommand="false" hasAbstractAttribute="false">
      <inheritances classname="Device_Impl" sourcePath=""/>
      <identification contact="at oats.inaf.it - demarco" author="demarco" emailDomain="oats.inaf.it" classFamily="Communication" siteSpecific="" platform="Unix Like" bus="TCP/UDP" manufacturer="none" reference=""/>
    </description>
    <commands name="State" description="This command gets the device state (stored in its device_state data member) and returns it to the caller." execMethod="dev_state" displayLevel="OPERATOR" polledPeriod="0">
      <argin description="none">
        <type xsi:type="pogoDsl:VoidType"/>
      </argin>
      <argout description="Device state">
        <type xsi:type="pogoDsl:StateType"/>
      </argout>
      <status abstract="true" inherited="true" concrete="true"/>
    </commands>
    <commands name="Status" description="This command gets the device status (stored in its device_status data member) and returns it to the caller." execMethod="dev_status" displayLevel="OPERATOR" polledPeriod="0">
      <argin description="none">
        <type xsi:type="pogoDsl:VoidType"/>
      </argin>
      <argout description="Device status">
        <type xsi:type="pogoDsl:ConstStringType"/>
      </argout>
      <status abstract="true" inherited="true" concrete="true"/>
    </commands>
    <preferences docHome="./doc_html" makefileHome="/usr/local/tango-8.1.2/share/pogo/preferences"/>
  </classes>
</pogoDsl:PogoSystem>