Commit d453a54d authored by Marco De Marco's avatar Marco De Marco
Browse files

Initial import

parents
Loading
Loading
Loading
Loading

Makefile

0 → 100644
+77 −0
Original line number Diff line number Diff line
#================================================================================
EXEC_NAME=metadataImporter-srv
INST_NAME=test
DEBUG_LEV=-v1
#================================================================================
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 \
	   ./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
#================================================================================
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
INC_PARM=$(foreach d, $(INC_DIR), -I$d)
LIB_PARM=$(foreach d, $(LIB_DIR), -L$d)
#================================================================================
SRC_DIR=./src
OBJ_DIR=./obj
BIN_DIR=./bin
#================================================================================
EXECUTABLE=$(BIN_DIR)/$(EXEC_NAME)
CPP_FILES=$(wildcard $(SRC_DIR)/*.cpp)
OBJ_FILES=$(addprefix $(OBJ_DIR)/,$(notdir $(CPP_FILES:.cpp=.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 $@ $<

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

.PHONY: clean
clean:
	-rm -rf $(OBJ_DIR) $(BIN_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)

src/ClassFactory.cpp

0 → 100644
+56 −0
Original line number Diff line number Diff line
/*----- PROTECTED REGION ID(MetadataImporter::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 :     Metadata importer device server
//
// 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 Lesser 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 Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser 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 <MetadataImporterClass.h>

//	Add class header files if needed


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

void Tango::DServer::class_factory()
{
	//	Add method class init if needed
	add_class(MetadataImporter_ns::MetadataImporterClass::init("MetadataImporter"));
}
/*----- PROTECTED REGION END -----*/	//	MetadataImporter::ClassFactory.cpp
+207 −0
Original line number Diff line number Diff line
/*----- PROTECTED REGION ID(MetadataImporter.cpp) ENABLED START -----*/
static const char *RcsId = "$Id:  $";
//=============================================================================
//
// file :        MetadataImporter.cpp
//
// description : C++ source for the MetadataImporter 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
//               MetadataImporter are implemented in this file.
//
// project :     Metadata importer device server
//
// 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 Lesser 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 Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser 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 <MetadataImporter.h>
#include <MetadataImporterClass.h>

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

/**
 *  MetadataImporter class description:
 *    Metadata importer device server
 */

//================================================================
//  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 MetadataImporter_ns
{
/*----- PROTECTED REGION ID(MetadataImporter::namespace_starting) ENABLED START -----*/

//	static initializations

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

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

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

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

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


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

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


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


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

//	Additional Methods

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

src/MetadataImporter.h

0 → 100644
+156 −0
Original line number Diff line number Diff line
/*----- PROTECTED REGION ID(MetadataImporter.h) ENABLED START -----*/
//=============================================================================
//
// file :        MetadataImporter.h
//
// description : Include file for the MetadataImporter class
//
// project :     Metadata importer device server
//
// 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 Lesser 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 Lesser General Public License for more details.
// 
// You should have received a copy of the GNU Lesser 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 MetadataImporter_H
#define MetadataImporter_H

#include <tango.h>


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

/**
 *  MetadataImporter class description:
 *    Metadata importer device server
 */

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

//	Additional Class Declarations

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

class MetadataImporter : public TANGO_BASE_CLASS
{

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

//	Add your own data members

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



//	Constructors and destructors
public:
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	MetadataImporter(Tango::DeviceClass *cl,string &s);
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device Name
	 */
	MetadataImporter(Tango::DeviceClass *cl,const char *s);
	/**
	 * Constructs a newly device object.
	 *
	 *	@param cl	Class.
	 *	@param s 	Device name
	 *	@param d	Device description.
	 */
	MetadataImporter(Tango::DeviceClass *cl,const char *s,const char *d);
	/**
	 * The device object destructor.
	 */	
	~MetadataImporter() {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      : MetadataImporter::read_attr_hardware()
	 *	Description : Hardware acquisition for attributes.
	 */
	//--------------------------------------------------------
	virtual void read_attr_hardware(vector<long> &attr_list);


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



//	Command related methods
public:


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

//	Additional Method prototypes

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

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

//	Additional Classes Definitions

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

}	//	End of namespace

#endif   //	MetadataImporter_H
+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="MetadataImporter" pogoRevision="8.1">
    <description description="Metadata importer device server" title="Metadata importer device server" sourcePath="/home/mdm/workspace/nadir/metadata_importer/src" language="Cpp" filestogenerate="XMI   file,Code files" license="LGPL" 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="Not Applicable" 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>