sample/high_traffic/common.cpp
#include <string>
#include <stdio.h>
#include <time.h>
#include <oess_1/stdsn/h/serializable.hpp>
#include <oess_1/stdsn/h/inout_templ.hpp>
class data_t
: public oess_1::stdsn::serializable_t
{
OESS_SERIALIZER( data_t )
public :
data_t()
{}
data_t(
unsigned int size )
: m_data( size, '0' )
{}
virtual ~data_t()
{}
private :
std::string m_data;
};
#include "common.ddl.cpp"
class a_common_t
: public so_4::rt::agent_t
{
typedef so_4::rt::agent_t base_type_t;
public :
a_common_t()
: base_type_t( agent_name() )
{}
virtual ~a_common_t()
{}
virtual const char *
so_query_type() const;
static std::string
agent_name()
{
return "a_common";
}
static std::string
agent_type()
{
return "a_common_t";
}
struct msg_request
{
unsigned int m_uid;
data_t m_data;
msg_request()
{}
msg_request(
unsigned int uid,
unsigned int size )
: m_uid( uid )
, m_data( size )
{}
static bool
check( const msg_request * cmd )
{
return ( 0 != cmd );
}
};
struct msg_reply
{
unsigned int m_uid;
msg_reply()
{}
msg_reply(
unsigned int uid )
: m_uid( uid )
{}
static bool
check( const msg_reply * cmd )
{
return ( 0 != cmd );
}
};
};
SOL4_CLASS_START( a_common_t )
SOL4_MSG_START( msg_request, a_common_t::msg_request )
SOL4_MSG_FIELD( m_uid )
SOL4_MSG_FIELD( m_data )
SOL4_MSG_CHECKER( a_common_t::msg_request::check )
SOL4_MSG_FINISH()
SOL4_MSG_START( msg_reply, a_common_t::msg_reply )
SOL4_MSG_FIELD( m_uid )
SOL4_MSG_CHECKER( a_common_t::msg_reply::check )
SOL4_MSG_FINISH()
SOL4_CLASS_FINISH()