Skip to content
Snippets Groups Projects
Commit 64c1d497 authored by Alexander Mueller's avatar Alexander Mueller
Browse files

%[ER: 34]%

Small changes in TM, SAL and PML
New: PA and PI
parent dd436964
No related branches found
No related tags found
No related merge requests found
Showing
with 1192 additions and 7 deletions
...@@ -122,24 +122,33 @@ CEP/Tools/PerfTest/P2Perf/src/Simulate.clog -text svneol=unset#unset ...@@ -122,24 +122,33 @@ CEP/Tools/PerfTest/P2Perf/src/Simulate.clog -text svneol=unset#unset
LCS/Common/src/Common-Model.cat -text LCS/Common/src/Common-Model.cat -text
LCS/databases/AOD/src/PL_V0.1.tar.gz -text svneol=unset#unset LCS/databases/AOD/src/PL_V0.1.tar.gz -text svneol=unset#unset
MAC/APL/lofarconf.in -text svneol=native#application/octet-stream MAC/APL/lofarconf.in -text svneol=native#application/octet-stream
MAC/Config/mac.ns -text svneol=native#application/octet-stream
MAC/Config/mac.top -text svneol=native#application/octet-stream
MAC/GCF/BaseTools/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/BaseTools/lofarconf.in -text svneol=native#application/octet-stream
MAC/GCF/GCFCommon/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/GCFCommon/autogen/protocol.tpl -text svneol=native#application/octet-stream
MAC/GCF/GCFCommon/configure.in -text svneol=native#application/octet-stream
MAC/GCF/GCFCommon/src/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/HighLevelTools/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/HighLevelTools/lofarconf.in -text svneol=native#application/octet-stream
MAC/GCF/Services/Activator/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Services/Activator/lofarconf.in -text svneol=native#application/octet-stream
MAC/GCF/Services/GCL/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Services/GCL/lofarconf.in -text svneol=native#application/octet-stream
MAC/GCF/Services/PI/SS/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Services/PI/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/Services/PI/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Services/PI/configure.in -text svneol=native#application/octet-stream
MAC/GCF/Services/PI/src/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/Services/PI/src/SS/F_Supervisory_Protocol.prot -text svneol=native#application/octet-stream
MAC/GCF/Services/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/Services/lofarconf.in -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PA/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PA/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/configure.in -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PA/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/src/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PA/src/PA_Protocol.prot -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PA/src/PA_Protocol.prot -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PML/Makefile -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PML/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PML/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PML/configure.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PML/configure.in -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PML/lofarconf.in -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PML/src/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/PML/src/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/PML/src/PA_Protocol.prot -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/SAL/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/SAL/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/SAL/configure.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/SAL/configure.in -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/SAL/lofarconf.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/SAL/src/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/SAL/test/Echo_Protocol.prot -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/SAL/test/Echo_Protocol.prot -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/SAL/test/Makefile.am -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/SAL/test/Makefile.am -text svneol=native#application/octet-stream
MAC/GCF/_CoreComps/SAL/test/tutorial.ns.in -text svneol=native#application/octet-stream MAC/GCF/_CoreComps/SAL/test/tutorial.ns.in -text svneol=native#application/octet-stream
......
log4cplus.rootLogger=INFO, STDOUT
log4cplus.additivity.ASTRON=FALSE
log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.TM.Logger=TRACE, STDOUT
log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.SAL.Logger=TRACE, STDOUT
log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.PML.Logger=TRACE, STDOUT
log4cplus.logger.ASTRON.LOFAR.MAC.GCF.CoreComps.PA.Logger=TRACE, STDOUT
log4cplus.logger.ASTRON.LOFAR.MAC.ExampleLogger=TRACE, EXAMPLEROLFILE
log4cplus.logger.ASTRON.LOFAR.MAC.ExampleLogger2=WARN, STDOUT
log4cplus.logger.ASTRON.LOFAR.MAC.PVSS_Test=INFO, PVSS_TEST_ROLFILE
log4cplus.appender.STDOUT=log4cplus::ConsoleAppender
log4cplus.appender.STDOUT.layout=log4cplus::PatternLayout
log4cplus.appender.STDOUT.layout.ConversionPattern=%d{%d-%m-%y %H:%M:%S} %-5p %c{2} - %m [%l]%n
log4cplus.appender.EXAMPLEROLFILE=log4cplus::RollingFileAppender
log4cplus.appender.EXAMPLEROLFILE.File=output_${ENV_VAR}.log
log4cplus.appender.EXAMPLEROLFILE.MaxFileSize=5MB
#log4cplus.appender.EXAMPLEROLFILE.MaxFileSize=500KB
log4cplus.appender.EXAMPLEROLFILE.MaxBackupIndex=5
log4cplus.appender.EXAMPLEROLFILE.layout=log4cplus::TTCCLayout
log4cplus.appender.PVSS_TEST_ROLFILE=log4cplus::RollingFileAppender
log4cplus.appender.PVSS_TEST_ROLFILE.File=pvss_test_output_${ENV_VAR}.log
log4cplus.appender.PVSS_TEST_ROLFILE.MaxFileSize=5MB
#log4cplus.appender.PVSS_TEST_ROLFILE.MaxFileSize=500KB
log4cplus.appender.PVSS_TEST_ROLFILE.MaxBackupIndex=5
log4cplus.appender.PVSS_TEST_ROLFILE.layout=log4cplus::PatternLayout
log4cplus.appender.PVSS_TEST_ROLFILE.layout.ConversionPattern=%d{%m/%d/%y %H:%M:%S},%m%n
#
# Name service configuration file.
#
# This file contains name and configuration information
# for tasks and their ports.
#
# For each task the host on which the task runs is specified
# with the 'host' attribute e.g.:
#
# [TASK_A]
# host=localhost
#
# For each SAP port the port type (TCP or UDP) can be
# specified with the .type' attribute e.g.:
#
# [TASK_B]
# host=localhost
# mysap.type=TCP
#
# For each SPP port the port type (.type), portnumber (.port)
# and host on which to find the SPP port (.host) can
# be specified e.g.
#
# [TASK_C]
# host=localhost
# myspp.type=UDP
# myspp.host=remotehost.remote.org
# myspp.port=20033
#
[PML]
host=localhost
client.type=TCP # SAP
[PA]
host=localhost
server.port=20040 # MSPP
server.type=TCP
#
# Each task is a block like this:
#
# [TaskName]
#
# For each task a specification is given of how to
# connect a task's SAP's to the remote tasks SPP like this:
#
# [TaskName]
# local_SAP_port_name = remote_task_name:remote_SPP_port_name
#
# Connections are initiated by the SAP and accepted
# by the SPP. Although establishing the connection
# is directional from SAP to SPP, the data transport
# via the ports is bidirectional.
#
#
# Connect SAP port 'client' of task 'PING' to
# SPP port 'server' of task 'ECHO'
#
[PML]
client=PA:server
[PA]
# has no SAP's
SUBDIRS=src
include $(lofar_sharedir)/Makefile.common
[+ AutoGen5 template ph +]
//
[+ (dne "// ") +][+ (out-push-add "/dev/null") +]
[+ DEFINE prefix_cap +][+ IF (exist? "prefix") +][+ (get "prefix") +][+ ENDIF +][+ ENDDEF +]
[+ DEFINE prefix_ucase +][+ IF (exist? "prefix") +][+ (string-upcase (get "prefix")) +][+ ENDIF +][+ ENDDEF +]
[+ DEFINE signal_name +][+ prefix_ucase +]_[+ (get "signal") +][+ ENDDEF +]
[+ DEFINE signal_id +][+ signal_name +]_ID[+ ENDDEF +]
[+ DEFINE struct_name +][+ prefix_cap +][+ (string-capitalize! (get "signal")) +]Event[+ ENDDEF +]
[+ DEFINE struct_decl +][+ struct_name +] : public GCFEvent[+ ENDDEF +]
[+ DEFINE protocol_name +][+ (string-upcase (base-name)) +][+ ENDDEF +]
[+ DEFINE param +][+ (get "type") +] [+ (get "name") +][+ IF (exist? "dim")+][[+ (get "dim") +]][+ ENDIF +][+ enddef +]
[+ DEFINE param_arg +][+ (get "type") +] [+ (get "name") +]_arg[+ IF (exist? "dim")+][[+ (get "dim") +]][+ ENDIF +][+ enddef +]
[+ (out-pop) +]
//
// [+ (base-name) +].h: [+ description +]
//
// Copyright (C) 2003
// ASTRON (Netherlands Foundation for Research in Astronomy)
// P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//
[+ (lgpl "This program" "ASTRON" "// ") +]
//
// $Id$
//
#ifndef [+ protocol_name +]_H
#define [+ protocol_name +]_H
#include <TM/GCF_TMProtocols.h>
[+ FOR include "" +]
#include [+ (get "include") +][+ ENDFOR +]
[+ (get "prelude") +]
namespace [+ (base-name) +]
{
//
// Define protocol message types
//
enum { [+ FOR event "," +]
[+ signal_id +][+ IF (= 0 (for-index)) +] = 1[+ ENDIF +][+ ENDFOR event +]
};
[+ FOR event "" +] #define [+ prefix_ucase +]_[+ (get "signal") +] F_SIGNAL([+ protocol_name +], [+ prefix_ucase +]_[+ (get "signal") +]_ID, F_[+ (get "dir")+])
[+ ENDFOR event +]
[+ FOR event "" +][+ IF (< 0 (count "param")) +]
struct [+ struct_decl +]
{
[+ struct_name +]([+ FOR param "," +]
[+ param_arg +][+ ENDFOR +])
: GCFEvent([+ signal_name +]),[+ FOR param "," +]
[+ (get "name") +]([+ IF (not (exist? "dim")) +][+ (get "name") +]_arg[+ ENDIF +])[+ ENDFOR +]
{
length = sizeof([+ struct_name +]);
[+ FOR param "" +]
[+ IF (exist? "dim") +]memcpy([+ (get "name") +], [+ (get "name") +]_arg, [+ (get "dim") +]);[+ ENDIF +][+ ENDFOR +]
}
[+ struct_name +]() : GCFEvent([+ signal_name +])
{
length = sizeof([+ struct_name +]);
}
[+ FOR param ";" +]
[+ param +][+ ENDFOR +];
};
[+ ENDIF +][+ ENDFOR +]
} // namespace [+ (base-name) +]
using namespace [+ (base-name) +];
#ifdef DECLARE_SIGNAL_NAMES
const char* [+ protocol_name +]_signalnames[] = {
"[+ protocol_name +]: invalid signal",[+ FOR event "," +]
"[+ signal_name +]"[+ ENDFOR +]
};
#else
// extern declaration of protocol event names
extern const char* [+ protocol_name +]_signalnames[];
#endif
#endif
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(src/GCF_Defines.h)
dnl AC_CONFIG_AUX_DIR(config)
dnl AM_CONFIG_HEADER(config/config.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(GCFTM, 0.1)
dnl Initialize for LOFAR (may set compilers)
lofar_INIT
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_YACC
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
dnl Checks for libraries.
dnl dnl Replace `main' with a function in -lfl:
dnl AC_CHECK_LIB(fl, main)
dnl dnl Replace `main' with a function in -lcosev_r:
dnl AC_CHECK_LIB(cosev_r, main)
dnl dnl Replace `main' with a function in -lcosnm_r:
dnl AC_CHECK_LIB(cosnm_r, main)
dnl dnl Replace `main' with a function in -lorb_r:
dnl AC_CHECK_LIB(orb_r, main)
dnl dnl Replace `main' with a function in -lpthread:
dnl AC_CHECK_LIB(pthread, main)
dnl dnl Replace `main' with a function in -lvport_r:
dnl AC_CHECK_LIB(vport_r, main)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
dnl
dnl Check for LOFAR specific things
dnl
lofar_DEBUG_OPTIMIZE
#lofar_QT
lofar_QATOOLS
lofar_DOCXX
lofar_MPI(0)
lofar_PACKAGE(LCS/Common)
lofar_PACKAGE(MAC/Tools/LofarLogger)
lofar_EXTERNAL(log4cplus,1,log4cplus/logger.h,log4cplus,)
dnl
dnl Output Makefiles
dnl
AC_OUTPUT(
src/Makefile
Makefile
)
/*------------------------------------------------------
CCmdLine
A utility for parsing command lines.
Copyright (C) 1999 Chris Losinger, Smaller Animals Software.
http://www.smalleranimals.com
This software is provided 'as-is', without any express
or implied warranty. In no event will the authors be
held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software
for any purpose, including commercial applications, and
to alter it and redistribute it freely, subject to the
following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
See SACmds.h for more info.
------------------------------------------------------*/
// if you're using MFC, you'll need to un-comment this line
// #include "stdafx.h"
#include "CmdLine.h"
/*------------------------------------------------------
int CCmdLine::SplitLine(int argc, char **argv)
parse the command line into switches and arguments
returns number of switches found
------------------------------------------------------*/
int CCmdLine::SplitLine(int argc, char **argv)
{
clear();
string curParam; // current argv[x]
// skip the exe name (start with i = 1)
for (int i = 1; i < argc; i++)
{
// if it's a switch, start a new CCmdLine
if (IsSwitch(argv[i]))
{
curParam = argv[i];
string arg;
// look at next input string to see if it's a switch or an argument
if (i + 1 < argc)
{
if (!IsSwitch(argv[i + 1]))
{
// it's an argument, not a switch
arg = argv[i + 1];
// skip to next
i++;
}
else
{
arg = "";
}
}
// add it
CCmdParam cmd;
// only add non-empty args
if (arg != "")
{
cmd.m_strings.push_back(arg);
}
// add the CCmdParam to 'this'
pair<CCmdLine::iterator, bool> res = insert(CCmdLine::value_type(curParam, cmd));
}
else
{
// it's not a new switch, so it must be more stuff for the last switch
// ...let's add it
CCmdLine::iterator theIterator;
// get an iterator for the current param
theIterator = find(curParam);
if (theIterator!=end())
{
(*theIterator).second.m_strings.push_back(argv[i]);
}
else
{
// ??
}
}
}
return size();
}
/*------------------------------------------------------
protected member function
test a parameter to see if it's a switch :
switches are of the form : -x
where 'x' is one or more characters.
the first character of a switch must be non-numeric!
------------------------------------------------------*/
bool CCmdLine::IsSwitch(const char *pParam)
{
if (pParam==NULL)
return false;
// switches must non-empty
// must have at least one character after the '-'
int len = strlen(pParam);
if (len <= 1)
{
return false;
}
// switches always start with '-'
if (pParam[0]=='-')
{
// allow negative numbers as arguments.
// ie., don't count them as switches
return (!isdigit(pParam[1]));
}
else
{
return false;
}
}
/*------------------------------------------------------
bool CCmdLine::HasSwitch(const char *pSwitch)
was the switch found on the command line ?
ex. if the command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.HasSwitch("-a") true
cmdLine.HasSwitch("-z") false
------------------------------------------------------*/
bool CCmdLine::HasSwitch(const char *pSwitch)
{
CCmdLine::iterator theIterator;
theIterator = find(pSwitch);
return (theIterator!=end());
}
/*------------------------------------------------------
string CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault)
fetch an argument associated with a switch . if the parameter at
index iIdx is not found, this will return the default that you
provide.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetSafeArgument("-a", 0, "zz") p1
cmdLine.GetSafeArgument("-a", 1, "zz") p2
cmdLine.GetSafeArgument("-b", 0, "zz") p4
cmdLine.GetSafeArgument("-b", 1, "zz") zz
------------------------------------------------------*/
string CCmdLine::GetSafeArgument(const char *pSwitch, unsigned int iIdx, const char *pDefault)
{
string sRet;
sRet = GetArgument(pSwitch, iIdx);
if (sRet.size() == 0 && pDefault != 0)
sRet = pDefault;
return sRet;
}
/*------------------------------------------------------
string CCmdLine::GetArgument(const char *pSwitch, int iIdx)
fetch a argument associated with a switch.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetArgument("-a", 0) p1
cmdLine.GetArgument("-b", 1) returns an empty string
------------------------------------------------------*/
string CCmdLine::GetArgument(const char *pSwitch, unsigned int iIdx)
{
if (HasSwitch(pSwitch))
{
CCmdLine::iterator theIterator;
theIterator = find(pSwitch);
if (theIterator!=end())
{
if ((*theIterator).second.m_strings.size() > iIdx)
{
return (*theIterator).second.m_strings[iIdx];
}
}
}
return "";
}
/*------------------------------------------------------
int CCmdLine::GetArgumentCount(const char *pSwitch)
returns the number of arguments found for a given switch.
returns -1 if the switch was not found
------------------------------------------------------*/
int CCmdLine::GetArgumentCount(const char *pSwitch)
{
int iArgumentCount = -1;
if (HasSwitch(pSwitch))
{
CCmdLine::iterator theIterator;
theIterator = find(pSwitch);
if (theIterator!=end())
{
iArgumentCount = (*theIterator).second.m_strings.size();
}
}
return iArgumentCount;
}
/*------------------------------------------------------
CCmdLine
A utility for parsing command lines.
Copyright (C) 1999 Chris Losinger, Smaller Animals Software.
http://www.smalleranimals.com
This software is provided 'as-is', without any express
or implied warranty. In no event will the authors be
held liable for any damages arising from the use of this software.
Permission is granted to anyone to use this software
for any purpose, including commercial applications, and
to alter it and redistribute it freely, subject to the
following restrictions:
1. The origin of this software must not be misrepresented;
you must not claim that you wrote the original software.
If you use this software in a product, an acknowledgment
in the product documentation would be appreciated but is not required.
2. Altered source versions must be plainly marked as such,
and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any source
distribution.
-------------------------
Example :
Our example application uses a command line that has two
required switches and two optional switches. The app should abort
if the required switches are not present and continue with default
values if the optional switches are not present.
Sample command line :
MyApp.exe -p1 text1 text2 -p2 "this is a big argument" -opt1 -55 -opt2
Switches -p1 and -p2 are required.
p1 has two arguments and p2 has one.
Switches -opt1 and -opt2 are optional.
opt1 requires a numeric argument.
opt2 has no arguments.
Also, assume that the app displays a 'help' screen if the '-h' switch
is present on the command line.
#include "CmdLine.h"
void main(int argc, char **argv)
{
// our cmd line parser object
CCmdLine cmdLine;
// parse argc,argv
if (cmdLine.SplitLine(argc, argv) < 1)
{
// no switches were given on the command line, abort
ASSERT(0);
exit(-1);
}
// test for the 'help' case
if (cmdLine.HasSwitch("-h"))
{
show_help();
exit(0);
}
// get the required arguments
string p1_1, p1_2, p2_1;
// if any of these fail, we'll end up in the catch() block
p1_1 = cmdLine.GetArgument("-p1", 0);
p1_2 = cmdLine.GetArgument("-p1", 1);
p2_1 = cmdLine.GetArgument("-p2", 0);
// get the optional parameters
// convert to an int, default to '100'
int iOpt1Val = atoi(cmdLine.GetSafeArgument("-opt1", 0, 100));
// since opt2 has no arguments, just test for the presence of
// the '-opt2' switch
bool bOptVal2 = cmdLine.HasSwitch("-opt2");
.... and so on....
}
If this class is used in an MFC application, string is CString, else
it uses the STL 'string' type.
If this is an MFC app, you can use the __argc and __argv macros from
you CYourWinApp::InitInstance() function in place of the standard argc
and argv variables.
------------------------------------------------------*/
#ifndef GCF_CMDLINE_H
#define GCF_CMDLINE_H
// if we're not using MFC, use STL strings
#define string string
// tell the compiler to shut up
#pragma warning(disable:4786)
//#include <iostream> // you may need this
#include <Common/lofar_map.h>
#include <Common/lofar_string.h>
#include <Common/lofar_vector.h>
// handy little container for our argument vector
struct CCmdParam
{
vector<string> m_strings;
};
// this class is actually a map of strings to vectors
typedef map<string, CCmdParam> _CCmdLine;
// the command line parser class
class CCmdLine : public _CCmdLine
{
public:
/*------------------------------------------------------
int CCmdLine::SplitLine(int argc, char **argv)
parse the command line into switches and arguments.
returns number of switches found
------------------------------------------------------*/
int SplitLine(int argc, char **argv);
/*------------------------------------------------------
bool CCmdLine::HasSwitch(const char *pSwitch)
was the switch found on the command line ?
ex. if the command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.HasSwitch("-a") true
cmdLine.HasSwitch("-z") false
------------------------------------------------------*/
bool HasSwitch(const char *pSwitch);
/*------------------------------------------------------
string CCmdLine::GetSafeArgument(const char *pSwitch, int iIdx, const char *pDefault)
fetch an argument associated with a switch . if the parameter at
index iIdx is not found, this will return the default that you
provide.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetSafeArgument("-a", 0, "zz") p1
cmdLine.GetSafeArgument("-a", 1, "zz") p2
cmdLine.GetSafeArgument("-b", 0, "zz") p4
cmdLine.GetSafeArgument("-b", 1, "zz") zz
------------------------------------------------------*/
string GetSafeArgument(const char *pSwitch, unsigned int iIdx, const char *pDefault = 0);
/*------------------------------------------------------
string CCmdLine::GetArgument(const char *pSwitch, int iIdx)
fetch a argument associated with a switch.
example :
command line is : app.exe -a p1 p2 p3 -b p4 -c -d p5
call return
---- ------
cmdLine.GetArgument("-a", 0) p1
cmdLine.GetArgument("-b", 1) returns an empty string
------------------------------------------------------*/
string GetArgument(const char *pSwitch, unsigned int iIdx);
/*------------------------------------------------------
int CCmdLine::GetArgumentCount(const char *pSwitch)
returns the number of arguments found for a given switch.
returns -1 if the switch was not found
------------------------------------------------------*/
int GetArgumentCount(const char *pSwitch);
protected:
/*------------------------------------------------------
protected member function
test a parameter to see if it's a switch :
switches are of the form : -x
where 'x' is one or more characters.
the first character of a switch must be non-numeric!
------------------------------------------------------*/
bool IsSwitch(const char *pParam);
};
#endif
...@@ -23,13 +23,31 @@ ...@@ -23,13 +23,31 @@
#ifndef GCF_DEFINES_H #ifndef GCF_DEFINES_H
#define GCF_DEFINES_H #define GCF_DEFINES_H
#define LOG_ERROR(X) do {} while (0) #include <LofarLogger/LofarLogger.h>
#define LOG_DEBUG(X) do {} while (0)
#define LOG_WARNING(X) do {} while (0)
#define LOG_INFO(X) do {} while (0)
#define MAX_PORTNAME_LEN 63
#define MAX_TASKNAME_LEN 63
#define MAX_PORTTYPE_LEN 31
#define MAXHOSTNAMELEN 31
#define GCF_LOGGER_ROOT (MAC_LOGGER_ROOT + string(".GCF"))
enum TGCFResult {
GCF_NO_ERROR = 1,
GCF_UNKNOWN_ERROR = 0,
GCF_PML_ERROR,
};
typedef unsigned short TAccessMode;
typedef struct
{
char propName[];
unsigned int type;
TAccessMode accessMode;
}
TProperty;
typedef struct
{
unsigned int nrOfProperties;
char scope[];
TProperty* properties;
}
TPropertySet;
#endif #endif
DOCHDRS = \
CmdLine.h \
GCF_Defines.h
lib_LTLIBRARIES = libgcfcommon.la
libgcfcommon_la_SOURCES= $(DOCHDRS) \
CmdLine.cc
include $(lofar_sharedir)/Makefile.common
SUBDIRS=src
include $(lofar_sharedir)/Makefile.common
dnl
dnl Process this file with autoconf to produce a configure script.
dnl
AC_INIT(src/GPI_Controller.h)
dnl AC_CONFIG_AUX_DIR(config)
dnl AM_CONFIG_HEADER(config/config.h)
AM_CONFIG_HEADER(config.h)
AM_INIT_AUTOMAKE(GCFTM, 0.1)
dnl Initialize for LOFAR (may set compilers)
lofar_INIT
dnl Checks for programs.
AC_PROG_AWK
AC_PROG_YACC
AC_PROG_CC
AC_PROG_CXX
AM_PROG_LEX
AC_PROG_INSTALL
AC_PROG_LN_S
AC_DISABLE_SHARED
AC_PROG_LIBTOOL
dnl Checks for libraries.
dnl dnl Replace `main' with a function in -lfl:
dnl AC_CHECK_LIB(fl, main)
dnl dnl Replace `main' with a function in -lcosev_r:
dnl AC_CHECK_LIB(cosev_r, main)
dnl dnl Replace `main' with a function in -lcosnm_r:
dnl AC_CHECK_LIB(cosnm_r, main)
dnl dnl Replace `main' with a function in -lorb_r:
dnl AC_CHECK_LIB(orb_r, main)
dnl dnl Replace `main' with a function in -lpthread:
dnl AC_CHECK_LIB(pthread, main)
dnl dnl Replace `main' with a function in -lvport_r:
dnl AC_CHECK_LIB(vport_r, main)
dnl Checks for header files.
AC_HEADER_STDC
AC_CHECK_HEADERS(unistd.h)
dnl Checks for typedefs, structures, and compiler characteristics.
AC_C_CONST
AC_TYPE_SIZE_T
dnl Checks for library functions.
AC_FUNC_VPRINTF
dnl
dnl Check for LOFAR specific things
dnl
lofar_DEBUG_OPTIMIZE
#lofar_QT
lofar_QATOOLS
lofar_DOCXX
lofar_MPI(0)
lofar_PVSS(1)
lofar_PACKAGE(LCS/Common)
lofar_PACKAGE(MAC/GCF/GCFCommon)
lofar_PACKAGE(MAC/GCF/CoreComps/TM)
lofar_PACKAGE(MAC/GCF/CoreComps/PA)
lofar_PACKAGE(MAC/GCF/CoreComps/SAL)
lofar_PACKAGE(MAC/Tools/LofarLogger)
lofar_EXTERNAL(log4cplus,1,log4cplus/logger.h,log4cplus,)
dnl
dnl Output Makefiles
dnl
AC_OUTPUT(
src/Makefile
Makefile
)
SS
//# GPI_Controller.cc:
//#
//# Copyright (C) 2002-2003
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program 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 2 of the License, or
//# (at your option) any later version.
//#
//# This program 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 this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include "GPI_Controller.h"
#include "GPI_SupervisoryServer.h"
#include "PI_Protocol.ph"
static string sPITaskName("PI");
GPIController::GPIController() :
GCFTask((State)&GPIController::initial, sPITaskName),
_isBusy(false)
{
// register the protocol for debugging purposes
registerProtocol(F_SUPERVISORY_PROTOCOL, F_SUPERVISORY_PROTOCOL_signalnames, 0);
// initialize the port provider
_ssPortProvider.init(*this, "pi", GCFPortInterface::MSPP, PI_PROTOCOL);
}
GPIController::~GPIController()
{
}
int GPIController::initial(GCFEvent& e, GCFPortInterface& p)
{
int status = GCFEvent::HANDLED;
switch (e.signal)
{
case F_INIT_SIG:
break;
case F_ENTRY_SIG:
case F_TIMER_SIG:
_ssPortProvider.open();
break;
case F_CONNECTED_SIG:
TRAN(&GPIController::connected);
break;
case F_DISCONNECTED_SIG:
if (&p == &_ssPortProvider)
_ssPortProvider.setTimer(1.0); // try again after 1 second
break;
default:
status = GCFEvent::NOT_HANDLED;
break;
}
return status;
}
int GPIController::connected(GCFEvent& e, GCFPortInterface& p)
{
int status = GCFEvent::HANDLED;
switch (e.signal)
{
case F_DISCONNECTED_SIG:
if (&p == &_ssPortProvider)
{
// TODO: find out this implies problems for the concrete ports too or not
}
break;
case F_ACCEPT_REQ:
{
GPISupervisoryServer* newSS = new GPISupervisoryServer(*this);
newSS->start();
_supervisoryServers.push_back(newSS);
_ssPortProvider.accept(*newSS);
break;
}
case F_TIMER_SIG:
{
GCFTimerEvent* pTimer = static_cast<GCFTimerEvent*>(&e);
if (pTimer->arg)
{
GPISupervisoryServer* pSS = static_cast<GPISupervisoryServer*>(pTimer->arg);
if (pSS)
{
_supervisoryServers.remove(pSS);
delete pSS;
}
}
break;
}
default:
status = GCFEvent::NOT_HANDLED;
break;
}
return status;
}
void GPIController::close(GPISupervisoryServer& ss)
{
_ssPortProvider.setTimer(0, 0, 0, 0, (void*)&ss);
}
\ No newline at end of file
//# GPI_Controller.h:
//#
//# Copyright (C) 2002-2003
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program 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 2 of the License, or
//# (at your option) any later version.
//#
//# This program 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 this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#ifndef GPI_CONTROLLER_H
#define GPI_CONTROLLER_H
#include <GPI_Defines.h>
#include <PML/GCF_SupervisedTask.h>
#include <TM/Socket/GCF_TCPPort.h>
class GCFEvent;
class GPISupervisoryServer;
class GPIController : public GCFTask
{
public:
GPIController();
virtual ~GPIController();
inline GCFTCPPort* getPortProvider() {return _ssPortProvider;}
void close(GPISupervisoryServer& ss);
private:
private: // helper methods
private: // state methods
int initial(GCFEvent& e, GCFPortInterface& p);
int connected(GCFEvent& e, GCFPortInterface& p);
int closing(GCFEvent& e, GCFPortInterface& p);
private: // data members
list<GPISupervisoryServer*> _supervisoryServers;
GCFTCPPort _ssPortProvider;
private: // admin. data members
bool _isBusy;
unsigned int _counter;
};
#endif
//# GPI_Defines.h: preprocessor definitions of various constants
//#
//# Copyright (C) 2002-2003
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program 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 2 of the License, or
//# (at your option) any later version.
//#
//# This program 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 this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#ifndef GPI_DEFINES_H
#define GPI_DEFINES_H
#include <GCFCommon/GCF_Defines.h>
#define CORE_COMPS_PI_LOGGER (GCF_LOGGER_ROOT + string(".CoreComps.PI"))
#define PI_STDOUT_LOGGER (CORE_COMPS_TM_LOGGER + string(".Logger"))
enum TPMResult {
PI_NO_ERROR = 1,
PI_UNKNOWN_ERROR = 0,
PI_PA_NOTCONNECTED,
PI_IS_BUSY,
PI_SCADA_ERROR,
};
#endif
//# GPI_Main.cc:
//#
//# Copyright (C) 2002-2003
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program 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 2 of the License, or
//# (at your option) any later version.
//#
//# This program 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 this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include <GPI_Controller.h>
int main(int argc, char *argv[])
{
//GCFTask::init(argc, argv);
GPIController propertyInterace;
propertyInterace.start();
GCFTask::run();
cerr << "Bye Bye" << endl;
// Just make the compilers happy...
return 0;
}
//# GPI_PropertyProxy.cc:
//#
//# Copyright (C) 2002-2003
//# ASTRON (Netherlands Foundation for Research in Astronomy)
//# P.O.Box 2, 7990 AA Dwingeloo, The Netherlands, seg@astron.nl
//#
//# This program 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 2 of the License, or
//# (at your option) any later version.
//#
//# This program 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 this program; if not, write to the Free Software
//# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//#
//# $Id$
#include "GPI_PropertyProxy.h"
void GPIPropertyProxy::propSubscribed(string& propName)
{
_ss.propSubscribed(propName);
}
void GPIPropertyProxy::propUnsubscribed(string& propName)
{
_ss.propUnsubscribed(propName);
}
void GPIPropertyProxy::propValueChanged(string& propName, GCFPValue& value)
{
_ss.propValueChanged(propName, value);
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment