Skip to content
Snippets Groups Projects
Commit f32fd7d3 authored by Ruud Overeem's avatar Ruud Overeem
Browse files

Bug 1284: SystemId was still of type int8 causing problems for stationnumbers >128.

Another (ancient) Ordina bug killed.
parent a6fd0b89
Branches
Tags
No related merge requests found
......@@ -45,23 +45,23 @@ public:
static bool isValidPropName(const char* propName);
static bool isValidScope (const char* propName);
static const string getSystemName(int8 sysnr);
static const string getSystemName(uint sysnr);
static const string& getLocalSystemName();
static int8 getLocalSystemId();
static int8 getSysId(const string& name);
static int8 getLastEventSysId();
static uint getLocalSystemId();
static uint getSysId(const string& name);
static uint getLastEventSysId();
static const string& getProjectName();
static timeval getLastEventTimestamp();
static uint8 getLastEventManNum();
static uint8 getOwnManNum();
static uint8 getLastEventManType();
static uint getLastEventManNum();
static uint getOwnManNum();
static uint getLastEventManType();
static TGCFResult getTypeStruct(const string& typeName,
list<TPropertyInfo>& propInfo,
int8 sysNr = getLocalSystemId());
uint sysNr = getLocalSystemId());
static void getAllProperties(const string& typeFilter, const string& dpFitler,
vector<string>& foundProperties);
......@@ -72,10 +72,10 @@ private:
friend class PVSSservice;
static string _sysName;
static string _projName;
static int8 _lastSysNr;
static uint _lastSysNr;
static timeval _lastTimestamp;
static uint8 _lastManNum;
static uint8 _lastManType;
static uint _lastManNum;
static uint _lastManType;
// Construction methods
// Don't allow to (con/de)struct an instance of this class
......@@ -90,7 +90,7 @@ private:
// </group>
};
inline int8 PVSSinfo::getLastEventSysId()
inline uint PVSSinfo::getLastEventSysId()
{
return _lastSysNr;
}
......@@ -100,12 +100,12 @@ inline timeval PVSSinfo::getLastEventTimestamp()
return _lastTimestamp;
}
inline uint8 PVSSinfo::getLastEventManNum()
inline uint PVSSinfo::getLastEventManNum()
{
return _lastManNum;
}
inline uint8 PVSSinfo::getLastEventManType()
inline uint PVSSinfo::getLastEventManType()
{
return _lastManType;
}
......
......@@ -37,10 +37,10 @@ namespace LOFAR {
string PVSSinfo::_sysName = "";
string PVSSinfo::_projName = "";
int8 PVSSinfo::_lastSysNr = 0;
uint PVSSinfo::_lastSysNr = 0;
timeval PVSSinfo::_lastTimestamp= {0, 0};
uint8 PVSSinfo::_lastManNum = 0;
uint8 PVSSinfo::_lastManType = 0;
uint PVSSinfo::_lastManNum = 0;
uint PVSSinfo::_lastManType = 0;
TMACValueType macValueTypes[] =
{
......@@ -129,7 +129,7 @@ TMACValueType PVSSinfo::getMACTypeId (const string& dpeName)
{
// first find out whether there is a system name specified or not
vector<string> splittedDpeName = StringUtil::split(dpeName, ':');
int8 sysNr = getSysId(dpeName);
uint sysNr = getSysId(dpeName);
if (sysNr == 0) {
sysNr = PVSSinfo::getLocalSystemId();
}
......@@ -161,7 +161,7 @@ const string& PVSSinfo::getLocalSystemName()
//
// getLocalSystemId()
//
int8 PVSSinfo::getLocalSystemId()
uint PVSSinfo::getLocalSystemId()
{
return((int)Resources::getSystem());
}
......@@ -169,7 +169,7 @@ int8 PVSSinfo::getLocalSystemId()
//
// getSystemName(sysnr)
//
const string PVSSinfo::getSystemName(int8 sysnr)
const string PVSSinfo::getSystemName(uint sysnr)
{
CharString sysName;
if (Manager::getSystemName(sysnr, sysName) == PVSS_TRUE) {
......@@ -193,18 +193,18 @@ const string& PVSSinfo::getProjectName()
//
// getSysId(name)
//
int8 PVSSinfo::getSysId(const string& name)
uint PVSSinfo::getSysId(const string& name)
{
string::size_type index = name.find(':');
if (index == string::npos) {
index = name.length();
}
CharString sysName(name.c_str(), index);
int sysNr;
uint sysNr;
// workaround - start
DpIdentifier dpId;
Manager::getId(sysName + ":", dpId);
sysNr = dpId.getSystem();
sysNr = (int)dpId.getSystem();
// workaround - end
/*
DpIdentificationResult res;
......@@ -219,7 +219,7 @@ int8 PVSSinfo::getSysId(const string& name)
//
// getOwnManNum()
//
uint8 PVSSinfo::getOwnManNum()
uint PVSSinfo::getOwnManNum()
{
return (Resources::getManNum());
}
......@@ -305,7 +305,7 @@ void buildTypeStructTree(const string path, const DpType* pType, const DpElement
//
TGCFResult PVSSinfo::getTypeStruct(const string& typeName,
list<TPropertyInfo>& propInfos,
int8 sysNr)
uint sysNr)
{
propInfos.clear();
......@@ -314,8 +314,8 @@ TGCFResult PVSSinfo::getTypeStruct(const string& typeName,
DpType* pType;
if (Manager::getTypeId(pvssTypeName, typeId, sysNr) == PVSS_FALSE) {
string sysName = getSystemName(sysNr);
LOG_ERROR(formatString("PVSS could not find type %s on system %s",
typeName.c_str(), sysName.c_str()));
LOG_ERROR(formatString("PVSS could not find type %s on system %s(%d)",
typeName.c_str(), sysName.c_str(), sysNr));
return(GCF_PVSS_ERROR);
}
......
AM_CPPFLAGS = -I$(top_srcdir)/PVSS/src
check_PROGRAMS = tPVSSservice tPerformance tPVSSconnect tMonitorState
check_PROGRAMS = tPVSSservice tPerformance tPVSSconnect tMonitorState tPVSSinfo
TESTS = tPVSSservice
......@@ -16,6 +16,10 @@ tPVSSconnect_SOURCES = $(BUILT_SOURCES) tPVSSconnect.cc
tPVSSconnect_LDADD = ../src/libgcfpvss.la $(LOFAR_DEPEND)
tPVSSconnect_DEPENDENCIES = ../src/libgcfpvss.la $(LOFAR_DEPEND)
tPVSSinfo_SOURCES = $(BUILT_SOURCES) tPVSSinfo.cc Response.cc
tPVSSinfo_LDADD = ../src/libgcfpvss.la $(LOFAR_DEPEND)
tPVSSinfo_DEPENDENCIES = ../src/libgcfpvss.la $(LOFAR_DEPEND)
tMonitorState_SOURCES = $(BUILT_SOURCES) tMonitorState.cc Response.cc
tMonitorState_LDADD = ../src/libgcfpvss.la $(LOFAR_DEPEND)
tMonitorState_DEPENDENCIES = ../src/libgcfpvss.la $(LOFAR_DEPEND)
......
//
// tPVSSinfo.cc: Test prog for manual testing queries
//
// Copyright (C) 2008
// 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 <lofar_config.h>
#include <Common/LofarLogger.h>
#include <Common/Exception.h>
#include <GCF/PVSS/GCF_PVTypes.h>
#include <GCF/PVSS/PVSSinfo.h>
#include "tPVSSservice.h"
#include "tPVSSinfo.h"
#include "Response.h"
namespace LOFAR {
namespace GCF {
using namespace TM;
namespace PVSS {
tPVSSinfo::tPVSSinfo(const string& name) :
GCFTask((State)&tPVSSinfo::initial, name),
itsService(0),
itsResponse(0),
itsTimerPort(0)
{
registerProtocol(F_FSM_PROTOCOL, F_FSM_PROTOCOL_STRINGS);
itsResponse = new Response;
itsTimerPort = new GCFTimerPort(*this, "timerPort");
}
tPVSSinfo::~tPVSSinfo()
{
if (itsService) {
delete itsService;
}
if (itsResponse) {
delete itsResponse;
}
if (itsTimerPort) {
delete itsTimerPort;
}
}
//
// initial (event, port)
//
GCFEvent::TResult tPVSSinfo::initial(GCFEvent& e, GCFPortInterface& /*p*/)
{
LOG_DEBUG_STR("initial:" << eventName(e));
GCFEvent::TResult status = GCFEvent::HANDLED;
switch (e.signal) {
case F_ENTRY:
break;
case F_INIT: {
itsService = new PVSSservice(itsResponse);
PVSSresult result;
try {
cout << "getLocalSystemId : " << (int)PVSSinfo::getLocalSystemId() << endl;
cout << "getLocalSystemName: " << PVSSinfo::getLocalSystemName() << endl;
cout << "getSystemName(Id) : " << PVSSinfo::getSystemName(PVSSinfo::getLocalSystemId()) << endl;
cout << "getSystemId(Name) : " << (int)PVSSinfo::getSysId(PVSSinfo::getLocalSystemName()) << endl;
cout << "getProjectName : " << PVSSinfo::getProjectName() << endl;
cout << "getOwnManNum : " << (int)PVSSinfo::getOwnManNum() << endl;
}
catch (Exception& except) {
cout << "One of the PVSS-calls went wrong" << endl;
}
GCFScheduler::instance()->stop();
}
break;
default:
status = GCFEvent::NOT_HANDLED;
break;
}
return status;
}
} // namespace PVSS
} // namespace GCF
} // namespace LOFAR
using namespace LOFAR::GCF;
int main(int argc, char* argv[])
{
TM::GCFScheduler::instance()->init(argc, argv);
PVSS::tPVSSinfo test_task("infoTest");
test_task.start(); // make initial transition
TM::GCFScheduler::instance()->run();
return 0;
}
// tPVSSinfo.h: Test prog for manual testing PVSS queries.
//
// Copyright (C) 2008
// 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 _TPVSSINFO_H
#define _TPVSSINFO_H
#include <GCF/TM/GCF_Control.h>
#include <GCF/PVSS/PVSSservice.h>
#include <GCF/PVSS/PVSSresponse.h>
namespace LOFAR {
namespace GCF {
using TM::GCFTask;
using TM::GCFTimerPort;
namespace PVSS {
/**
* The tPVSSinfo task receives ECHO_PING events from the Ping task and
* returns an ECHO_ECHO event for each ECHO_PING event received.
*/
class tPVSSinfo : public GCFTask
{
public:
tPVSSinfo (const string& name);
virtual ~tPVSSinfo();
GCFEvent::TResult initial (GCFEvent& e, GCFPortInterface& p);
private:
PVSSservice* itsService;;
PVSSresponse* itsResponse;
GCFTimerPort* itsTimerPort;
};
} // namespace PVSS
} // namespace GCF
} // namespace LOFAR
#endif
......@@ -274,7 +274,7 @@ string RTDBPropertySet::getFullScope () const
void RTDBPropertySet::_createAllProperties()
{
// Get ID of this PVSS database
int8 sysNr = PVSSinfo::getSysId(itsScope);
int sysNr = PVSSinfo::getSysId(itsScope);
if (sysNr == 0) {
sysNr = PVSSinfo::getLocalSystemId();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment