📄 objects.cpp
字号:
/* ======================================================================== *\
|
|
| JOYIT Communication Technology
| Copyright (C) 2002-2003, All Right Reserved.
|
| System: Programmable Signaling Gateway
| Sub-system:
| Filename: objects.cpp
| Environment: LINUX -- Red Hat 9.0 & GNU C/C++ Compiler 3.2.2
| vxWorks -- Tornado 2.0 & vxWorks 5.4
| Function description: Define the method of base OBJECT class.
|
|
\* ======================================================================== */
#ifndef _OBJECTS_HPP
#include "objects.hpp"
#endif
#ifndef _WERROR_HPP
#include "werror.hpp"
#endif
#ifdef __cplusplus
extern "C"
{
#endif
#ifdef __LINUX__
#ifndef _TIME_H
#include <time.h>
#endif
#ifndef _STDIO_H
#include <stdio.h>
#endif
#elif __VXWORKS__
#ifndef __INCtimeh
#include <time.h>
#endif
#ifndef __INCstdioh
#include <stdio.h>
#endif
#endif
#ifdef __cplusplus
};
#endif
WObject::WObject( ) : innerQueue(MAXINNERQ),
// objectType(otCommon),
// objectId(0),
oState(ostInit),
eventMask(0L)
{
#ifdef __DEBUG__
printf("Object created.\n");
#endif
// Register to the object manager.
// The objectId would be allocate by the object manager.
}
WObject::~WObject( )
{
deleteAll( );
// Degister from the object manager.
}
void WObject::handleEvent(WEvent& event)
{
event.what = evNothing;
}
void WObject::getEvent(WEvent& event)
{
innerQueue.popEvent(event);
}
void WObject::insert(WEvent& event)
{
innerQueue.insertEvent(event);
}
void WObject::putEvent(WEvent& event)
{
innerQueue.pushEvent(event);
}
void WObject::idle( )
{
}
void WObject::deleteAll( )
{
innerQueue.Clear( );
}
/*
void WObject::error(ERRCOD_T werr, INT16 mid, const char * const errmsg)
// Error code and the module/object id that error emergency.
{
// log the error message.
time_t ptm;
ptm = time(&ptm);
}
*/
void WObject::OAMagent( )
{
}
INT16 WObject::SetObjectState(INT16 ost)
{
INT16 o = oState;
oState = ost;
return o; // Return previous state to the caller.
}
INT16 WObject::GetObjectState( )
{
return oState;
}
UINT32 WObject::SetMask(UINT32 em)
{
UINT32 oem = eventMask;
eventMask = em;
return oem; // Return previous event mask to the caller.
}
UINT32 WObject::GetMask( )
{
return eventMask;
}
void WObject::ClearMask( )
{
eventMask = 0L;
}
char * WObject::name( )
{
return "WObject";
}
// ------------------------------------------------------------------------
//
// Revision list.
// ==============
//
// 1.0, 2003-04-18, Wu jianjin
// Initial version.
// 1.1, 2003-05-19, Wu jianjin
// Ported to vxWorks.
//
// ------------------------------------------------------------------------
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -