Files
xahaud/modules/ripple_core/test/SimplePayload.h
2013-09-05 04:38:17 -07:00

72 lines
1.3 KiB
C++

//------------------------------------------------------------------------------
/*
Copyright (c) 2011-2013, OpenCoin, Inc.
*/
//==============================================================================
#ifndef RIPPLE_CORE_TEST_SIMPLEPAYLOAD_H_INCLUDED
#define RIPPLE_CORE_TEST_SIMPLEPAYLOAD_H_INCLUDED
namespace TestOverlay
{
/** A simple message payload. */
class SimplePayload
{
public:
SimplePayload ()
{
}
SimplePayload (int what, String data = String::empty, int hops = 0)
: m_hops (hops)
, m_what (what)
, m_data (data)
{
}
SimplePayload (SimplePayload const& other)
: m_hops (other.m_hops)
, m_what (other.m_what)
, m_data (other.m_data)
{
}
SimplePayload& operator= (SimplePayload const& other)
{
m_hops = other.m_hops;
m_what = other.m_what;
m_data = other.m_data;
return *this;
}
SimplePayload withHop () const
{
return SimplePayload (m_what, m_data, m_hops + 1);
}
int hops () const
{
return m_hops;
}
int what () const
{
return m_what;
}
String data () const
{
return m_data;
}
private:
int m_hops;
int m_what;
String m_data;
};
}
#endif