Home Libraries Author Links

stm::tools::McBspMessage< ContextT > Class Template Reference
[McBspMsg: McBSP Message Model]

Inheritance diagram for stm::tools::McBspMessage< ContextT >:

Inheritance graph
[legend]
Collaboration diagram for stm::tools::McBspMessage< ContextT >:

Collaboration graph
[legend]

List of all members.


Detailed Description

template<class ContextT>
class stm::tools::McBspMessage< ContextT >

McBSP message scanning from a BaseMessage's byte_iterator_range.

ContextT shall be a specialization of BaseMessageContext or be publicly derived therefrom. If ContextT is a specialization of BinMessageContext (which is publicly derived from a BaseMessageContext specialization) or is publicly derived therefrom, ContextT is also a BinMessage<ContextT> factory and the type McBspMessage<ContextT> can be registered as BinMessage<ContextT> type known to that factory.

Definition at line 112 of file mcbspmsg.hpp.


Public Types

typedef ContextT context_type
 Context type of the messages to be scanned.
typedef BaseMessage< ContextT > basemessage_type
 Base type of this McBspMessage.

Public Member Functions

 McBspMessage (const byte *first, const byte *last, context_type &context, dword flags=basemessage_type::NoFlags) throw (std::exception)
 Construct a McBspMessage object from the range [first, last) read from context.
const std::string & type () const
 Return the message type string.

Static Public Member Functions

static const std::string & Type ()
 Return the static message type string.

Member Typedef Documentation

template<class ContextT>
typedef ContextT stm::tools::McBspMessage< ContextT >::context_type

Context type of the messages to be scanned.

Reimplemented from stm::tools::BaseMessage< ContextT >.

Definition at line 121 of file mcbspmsg.hpp.

template<class ContextT>
typedef BaseMessage<ContextT> stm::tools::McBspMessage< ContextT >::basemessage_type

Base type of this McBspMessage.

Reimplemented from stm::tools::BaseMessage< ContextT >.

Definition at line 124 of file mcbspmsg.hpp.


Constructor & Destructor Documentation

template<class ContextT>
stm::tools::McBspMessage< ContextT >::McBspMessage ( const byte *  first,
const byte *  last,
context_type context,
dword  flags = basemessage_type::NoFlags 
) throw (std::exception)

Construct a McBspMessage object from the range [first, last) read from context.

If a McBsp message (optionally preceded by a 4 or 5 byte FPGA timestamp) begins with first and fits completely into the range [first, last), the constructor succeeds. Then the method status() returns BaseMessage::NoError, the method begin() returns first, the method end() returns a byte pointer to the byte after the McBSP end word of the message and the method body() returns the byte range consisting of the message's body excluding any padding bytes.

Else if the flags bit BaseMessage::ThrowOnError is not set, status () returns BaseMessage::OutOfSync or BaseMessage::ConsistencyError, begin() returns first, end() returns a byte pointer to the next plausible begin of a McBSP message and body() returns the offended byte range which may be empty. If the flags bit BaseMessage::ThrowOnError is set, the construcor throws std::runtime_error in these cases.

On other errors the constructor throws std::logic_error, if one of the arguments supplied is wrong, or std::range_error, if a McBsp message potentially begins with first, but does not fit completely into the range [first, last).


Member Function Documentation

template<class ContextT>
const std::string& stm::tools::McBspMessage< ContextT >::type (  )  const [virtual]

Return the message type string.

Implements the pure virtual method basemessage_type::type().

Implements stm::tools::BaseMessage< ContextT >.

template<class ContextT>
static const std::string& stm::tools::McBspMessage< ContextT >::Type (  )  [static]

Return the static message type string.


© Copyright Tom Michaelis 2002-2007

Distributed under the SysToMath Software License (See the accompanying file license.txt or a copy at www.SysToMath.com).