Skip to content

Commit

Permalink
TE refactored
Browse files Browse the repository at this point in the history
  • Loading branch information
mpusz committed Oct 20, 2011
1 parent 749f3b7 commit e9671a1
Show file tree
Hide file tree
Showing 11 changed files with 1,943 additions and 247 deletions.
51 changes: 51 additions & 0 deletions freettcn/lib/include/freettcn/te/eds.h
@@ -0,0 +1,51 @@
//
// Copyright (C) 2007 Mateusz Pusz
//
// This file is part of freettcn (Free TTCN) library.

// This library 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 2.1 of the License, or
// (at your option) any later version.

// This library 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 this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

/**
* @file eds.h
* @author Mateusz Pusz
* @date Sat Apr 7 22:10:55 2007
*
* @brief
*
*
*/

#ifndef __EDS_H__
#define __EDS_H__

#include <freettcn/tools/nonCopyable.h>

namespace freettcn {

namespace TE {

class CEncodingDecodingSystem : CNonCopyable
{
public:
CEncodingDecodingSystem() = default;
~CEncodingDecodingSystem() = default;
};

} // namespace TE

} // namespace freettcn


#endif /* __EDS_H__ */
66 changes: 66 additions & 0 deletions freettcn/lib/include/freettcn/te/ets.h
@@ -0,0 +1,66 @@
//
// Copyright (C) 2007 Mateusz Pusz
//
// This file is part of freettcn (Free TTCN) library.

// This library 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 2.1 of the License, or
// (at your option) any later version.

// This library 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 this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

/**
* @file ets.h
* @author Mateusz Pusz
* @date Sat Apr 7 22:10:55 2007
*
* @brief
*
*
*/

#ifndef __ETS_H__
#define __ETS_H__

#include <freettcn/tools/nonCopyable.h>
#include <freettcn/etsi/tci.h>
#include <freettcn/te/builtInTypes.h>

namespace freettcn {

class CType;

namespace TE {

class CModule;

using namespace ORG_ETSI_TTCN3_TCI;

class CExecutableTestSuite : CNonCopyable
{
const CBuiltInTypes _builtInTypes;
public:
CExecutableTestSuite() = default;
~CExecutableTestSuite() = default;

CModule &Module(const TciModuleId &moduleId) const;
CModule &Module(const Tstring &moduleName) const;

const CBuiltInTypes &TypeTTCN3() const { return _builtInTypes; }
std::shared_ptr<const freettcn::CType> Type(const Tstring &typeName) const;
};

} // namespace TE

} // namespace freettcn


#endif /* __ETS_H__ */
121 changes: 121 additions & 0 deletions freettcn/lib/include/freettcn/te/t3rts.h
@@ -0,0 +1,121 @@
//
// Copyright (C) 2007 Mateusz Pusz
//
// This file is part of freettcn (Free TTCN) library.

// This library 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 2.1 of the License, or
// (at your option) any later version.

// This library 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 this library; if not, write to the Free Software
// Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA

/**
* @file t3rts.h
* @author Mateusz Pusz
* @date Sat Apr 7 22:10:55 2007
*
* @brief
*
*
*/

#ifndef __T3RTS_H__
#define __T3RTS_H__

#include <freettcn/tools/nonCopyable.h>
#include <freettcn/etsi/tci.h>
#include <freettcn/etsi/tri.h>
#include <freettcn/tools/tools.h>
#include <memory>
#include <map>

namespace freettcn {

namespace TE {

class CEnvironment;
class CExecutableTestSuite;
class CModule;
class CTestCase;
class CComponent;
class CBehaviour;
// class CTimer;

using namespace ORG_ETSI_TTCN3_TCI;
using namespace ORG_ETSI_TTCN3_TRI;

class CTTCN3RuntimeSystem : CNonCopyable
{
typedef std::map<const TriComponentId *, std::unique_ptr<CComponent>, CPtrCmp> CComponentMap;
const CEnvironment *_env;
const CExecutableTestSuite &_ets;

CModule *_rootModule;
bool _ctrlRunning;
const CTestCase *_activeTestCase;
CComponentMap _componentMap;
// CComponent *_ctrlComponent;

protected:
const CTestCase &ActiveTestCase() const;
CComponent *ComponentCheck(const TriComponentId &component) const;

bool Running() const;

public:
CTTCN3RuntimeSystem(const CExecutableTestSuite &ets);
~CTTCN3RuntimeSystem() = default;

void Environment(const CEnvironment &env) { _env = &env; }

void Reset();

void RootModule(const TciModuleId &moduleName);
CModule &RootModule() const;

CComponent &Component(const TriComponentId &component) const;
// CTimer &Timer(const TriTimerId &timerId) const;

const TriComponentId *ControlStart();
void ControlStop();
void TestCaseStart(const TciTestCaseId &testCaseId,
const TciParameterList *parameterList);
void TestCaseExecute(const TciTestCaseId &testCaseId,
const TriPortIdList *tsiPortList);
void TestCaseStop();

const TriComponentId *TestComponentCreate(TciTestComponentKind kind,
const TciType *componentType,
const Tstring *name);
void TestComponentStart(const TriComponentId &component,
const CBehaviour &behaviour,
const TciParameterList *parameterList);
void TestComponentStop(const TriComponentId &component);
void TestComponentKill(const TriComponentId &component);
void TestComponentTerminated(const TriComponentId &component,
const VerdictValue &verdict) const;

const TriComponentId *MTC() const;

void Connect(const TriPortId &port1, const TriPortId &port2);
void Disconnect(const TriPortId &port1, const TriPortId &port2);
void Map(const TriPortId &port1, const TriPortId &port2);
void Unmap(const TriPortId &port1, const TriPortId &port2);

void Timeout(const TriTimerId &timerId);
};

} // namespace TE

} // namespace freettcn


#endif /* __T3RTS_H__ */
135 changes: 92 additions & 43 deletions freettcn/lib/include/freettcn/te/te.h
Expand Up @@ -30,64 +30,113 @@
#ifndef __TE_H__
#define __TE_H__


extern "C" {
#include <freettcn/ttcn3/tci.h>
#include <freettcn/ttcn3/tri.h>
}
#include <freettcn/etsi/TciTmRequired.h>
#include <freettcn/etsi/TciChRequired.h>
#include <freettcn/etsi/TciCdRequired.h>
#include <freettcn/etsi/TriPlatformTE.h>
#include <freettcn/etsi/TriCommunicationTE.h>
#include <freettcn/tools/entity.h>
#include <freettcn/te/ets.h>
#include <freettcn/te/eds.h>
#include <freettcn/te/t3rts.h>

#include <string>

namespace freettcn {

namespace TE {

class CEnvironment;

class CModule;
using namespace ORG_ETSI_TTCN3_TCI;
using namespace ORG_ETSI_TTCN3_TRI;

class CTTCNExecutable : public freettcn::CEntity {
static CTTCNExecutable _instance;

CModule *_rootModule;

CTTCNExecutable();
virtual ~CTTCNExecutable();

void TciError(const std::string &str) const;

protected:
CModule &RootModule() const;
class CTTCN3Executable : public freettcn::CEntity,
public ORG_ETSI_TTCN3_TCI::TciTmRequired,
public ORG_ETSI_TTCN3_TCI::TciChRequired,
public ORG_ETSI_TTCN3_TCI::TciCdRequired,
public ORG_ETSI_TTCN3_TRI::TriPlatformTE,
public ORG_ETSI_TTCN3_TRI::TriCommunicationTE
{
std::unique_ptr<const CEnvironment> _env;
CExecutableTestSuite _ets;
CEncodingDecodingSystem _eds;
CTTCN3RuntimeSystem _t3rts;

public:
static CTTCNExecutable &Instance();
CTTCN3Executable();
~CTTCN3Executable() = default;

void Environment(std::unique_ptr<const CEnvironment> env);

// TM requests
void RootModule(String moduleId);
TciModuleParameterListType ModuleParametersGet(const TciModuleIdType &moduleName) const;
TciTestCaseIdListType TestCasesGet() const;
TciParameterTypeListType TestCaseParametersGet(const TciTestCaseIdType &testCaseId) const;
TriPortIdList TestCaseTSIGet(const TciTestCaseIdType &testCaseId) const;
void TestCaseStart(const TciTestCaseIdType &testCaseId, const TciParameterListType &parameterlist) const;
void TestCaseStop() const;
const TriComponentId &ControlStart() const;
void ControlStop() const;
void tciRootModule(const TciModuleId *moduleName) override;
const TciModuleIdList *getImportedModules() const override;
const TciModuleParameterList *tciGetModuleParameters(const TciModuleId *moduleName) override;
const TciTestCaseIdList *tciGetTestCases() const override;
const TciParameterTypeList *tciGetTestCaseParameters(const TciTestCaseId *testCaseId) const override;
const TriPortIdList *tciGetTestCaseTSI(const TciTestCaseId &testCaseId) const override;
void tciStartTestCase(const TciTestCaseId *testCaseId, const TciParameterList *parameterList) override;
void tciStopTestCase() override;
const TriComponentId *tciStartControl() override;
void tciStopControl() override;

// CH requests
void ConnectedMsgEnqueue(const TriPortId &sender, const TriComponentId &receiver, const Value &rcvdMessage) const;
const TriComponentId &TestComponentCreate(TciTestComponentKindType kind, const Type &componentType, String name) const;
void TestComponentStart(const TriComponentId &componentId, const TciBehaviourIdType &behaviorId, const TciParameterListType &parameterList) const;
void TestComponentStop(const TriComponentId &componentId) const;
void TestComponentKill(const TriComponentId &component) const;
void Connect(const TriPortId &fromPort, const TriPortId &toPort) const;
void Disconnect(const TriPortId &fromPort, const TriPortId &toPort) const;
void Map(const TriPortId &fromPort, const TriPortId &toPort) const;
void Unmap(const TriPortId &fromPort, const TriPortId &toPort) const;
void TestComponentTerminated(const TriComponentId &componentId, const VerdictValue &verdict) const;
void TestCaseExecute(const TciTestCaseIdType &testCaseId, const TriPortIdList &tsiPortList) const;
void Reset() const;
void tciEnqueueMsgConnected(const TriPortId *sender, const TriComponentId *receiver,
const TciValue *rcvdMessage) override;
void tciEnqueueCallConnected(const TriPortId *sender, const TriComponentId *receiver,
const TriSignatureId *signature, const TciParameterList *parameterList) override;
void tciEnqueueReplyConnected(const TriPortId *sender, const TriComponentId *receiver,
const TriSignatureId *signature, const TciParameterList *parameterList,
const TciValue *returnValue) override;
void tciEnqueueRaiseConnected(const TriPortId *sender, const TriComponentId *receiver,
const TriSignatureId *signature, const TciValue *exception) override;
const TriComponentId *tciCreateTestComponent(const TciTestComponentKind *kind,
const TciType *componentType, const Tstring *name) override;
void tciStartTestComponent(const TriComponentId *component, const TciBehaviourId *behaviour,
const TciParameterList *parameterList) override;
void tciStopTestComponent(const TriComponentId *component) override;
void tciConnect(const TriPortId *fromPort, const TriPortId *toPort) override;
void tciDisconnect(const TriPortId *fromPort, const TriPortId *toPort) override;
void tciMap(const TriPortId *fromPort, const TriPortId *toPort) override;
void tciUnmap(const TriPortId *fromPort, const TriPortId *toPort) override;
void tciTestComponentTerminated(const TriComponentId *component, const VerdictValue *verdict) const override;
Tboolean tciTestComponentRunning(const TriComponentId *component) const override;
Tboolean tciTestComponentDone(const TriComponentId *comp) const override;
const TriComponentId *tciGetMTC() const override;
void tciExecuteTestCase(const TciTestCaseId *testCaseId, const TriPortIdList *tsiPortList) override;
void tciReset() override;
void tciKillTestComponent(const TriComponentId *comp) override;
Tboolean tciTestComponentAlive(const TriComponentId *comp) const override;
Tboolean tciTestComponentKilled(const TriComponentId *comp) const override;

// CD requests
const TciType *getTypeForName(const Tstring typeName) const override;
const TciType &getInteger() const override;
const TciType &getFloat() const override;
const TciType &getBoolean() const override;
const TciType &getCharstring() const override;
const TciType &getUniversalCharstring() const override;
const TciType &getHexstring() const override;
const TciType &getBitstring() const override;
const TciType &getOctetstring() const override;
const TciType &getVerdict() const override;
void tciErrorReq(const Tstring message) override;

// PA requests
void Timeout(const TriTimerId* timerId);
void triTimeout(const TriTimerId *timerId) override;

// SA requests
void triEnqueueMsg(const TriPortId *tsiPortId, const TriAddress *SUTaddress,
const TriComponentId *componentId, const TriMessage *receivedMessage) override;
void triEnqueueCall(const TriPortId *tsiPortId, const TriAddress *SUTaddress,
const TriComponentId *componentId, const TriSignatureId *signatureId,
const TriParameterList *parameterList) override;
void triEnqueueReply(const TriPortId *tsiPortId, const TriAddress *SUTaddress,
const TriComponentId *componentId, const TriSignatureId *signatureId,
const TriParameterList *parameterList, const TriParameter *returnValue) override;
void triEnqueueException(const TriPortId *tsiPortId, const TriAddress *SUTaddress,
const TriComponentId *componentId, const TriSignatureId *signatureId,
const TriException *exc) override;
};

} // namespace TE
Expand Down

1 comment on commit e9671a1

@bllie
Copy link

@bllie bllie commented on e9671a1 Mar 2, 2014

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

dear sir, I can not compile freettcn pass using gcc 4.3
the error information is as follows:
reettcn/lib/tools/../include/freettcn/tools/nonAssignable.h:27: error: invalid pure specifier (only = 0' is allowed) before ‘;’ token freettcn/lib/tools/../include/freettcn/tools/nonAssignable.h:27: error: initializer specified for non-virtual method ‘freettcn::CNonAssignable& freettcn::CNonAssignable::operator=(const freettcn::CNonAssignable&)’ In file included from freettcn/lib/tools/../include/freettcn/tools/entity.h:32, from freettcn/lib/tools/entity.cpp:29: freettcn/lib/tools/../include/freettcn/tools/nonCopyable.h:29: error: invalid pure specifier (only= 0' is allowed) before ‘;’ token
freettcn/lib/tools/../include/freettcn/tools/nonCopyable.h:30: error: invalid pure specifier (only = 0' is allowed) before ‘;’ token freettcn/lib/tools/../include/freettcn/tools/nonCopyable.h:29: error: initializer specified for non-virtual method ‘freettcn::CNonCopyable::CNonCopyable()’ freettcn/lib/tools/../include/freettcn/tools/nonCopyable.h:30: error: initializer specified for non-virtual method ‘freettcn::CNonCopyable::CNonCopyable(const freettcn::CNonCopyable&)’ make[3]: *** [freettcn/lib/tools/../bin/libtools.a(freettcn/lib/tools/../bin/entity.o)] 错误 1 MAKE freettcn/lib/ttcn3 CC_D_A freettcn/lib/ttcn3/tciType.cpp In file included from freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:34, from freettcn/lib/ttcn3/tciType.cpp:32: freettcn/lib/ttcn3/../include/freettcn/tools/nonAssignable.h:27: error: invalid pure specifier (only= 0' is allowed) before ‘;’ token
freettcn/lib/ttcn3/../include/freettcn/tools/nonAssignable.h:27: error: initializer specified for non-virtual method ‘freettcn::CNonAssignable& freettcn::CNonAssignable::operator=(const freettcn::CNonAssignable&)’
In file included from freettcn/lib/ttcn3/tciType.cpp:32:
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:50: error: invalid pure specifier (only = 0' is allowed) before ‘;’ token freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:56: error: invalid pure specifier (only= 0' is allowed) before ‘;’ token
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:57: error: invalid pure specifier (only = 0' is allowed) before ‘;’ token freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:50: error: initializer specified for non-virtual method ‘freettcn::CType::CValue::CValue(const freettcn::CType::CValue&)’ freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:56: error: initializer specified for non-virtual method ‘freettcn::CType::CValue::CValue(freettcn::CType::CValue&&)’ freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:72: error: invalid pure specifier (only= 0' is allowed) before ‘;’ token
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:90: error: invalid pure specifier (only = 0' is allowed) before ‘;’ token freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:99: error: invalid pure specifier (only= 0' is allowed) before ‘;’ token
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:100: error: invalid pure specifier (only `= 0' is allowed) before ‘;’ token
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:90: error: initializer specified for non-virtual method ‘freettcn::CType::CType(const freettcn::CType&)’
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:99: error: initializer specified for non-virtual method ‘freettcn::CType::CType(freettcn::CType&&)’
freettcn/lib/ttcn3/tciType.cpp: In member function ‘virtual ORG_ETSI_TTCN3_TCI::TciValue* freettcn::CType::CValueOmitted::clone() const’:
freettcn/lib/ttcn3/tciType.cpp:78: error: cannot allocate an object of abstract type ‘freettcn::CType::CValueOmitted’
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:67: note: because the following virtual functions are pure within ‘freettcn::CType::CValueOmitted’:
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:72: note: virtual freettcn::CType::CValueOmitted::~CValueOmitted()
freettcn/lib/ttcn3/../include/freettcn/ttcn3/tciType.h:72: note: virtual freettcn::CType::CValueOmitted::~CValueOmitted()
freettcn/lib/ttcn3/tciType.cpp: In constructor ‘freettcn::CType::CType(const std::shared_ptr&, const Tstring&, const ORG_ETSI_TTCN3_TCI::TciTypeClass&, const Tstring&, const Tstring&, const std::vector<Tstring*, std::allocator<Tstring*> >&)’:
freettcn/lib/ttcn3/tciType.cpp:110: error: expected primary-expression before ‘[’ token
freettcn/lib/ttcn3/tciType.cpp:110: error: expected primary-expression before ‘’ token
freettcn/lib/ttcn3/tciType.cpp:110: error: ‘str’ was not declared in this scope
make[3]: *
* [freettcn/lib/ttcn3/../bin/libttcn3.a(freettcn/lib/ttcn3/../bin/tciType.o)] 错误 1
MAKE freettcn/lib/te

can you help me?

Please sign in to comment.