LIBRCSC Docs
Documentation for HELIOS's BASE LIBRCSC library for RoboCup 2D Simulation League.
All Classes Files Functions Variables Typedefs Enumerations Enumerator Macros
freeform_message.h
Go to the documentation of this file.
1// -*-c++-*-
2
8/*
9 *Copyright:
10
11 Copyright (C) Hidehisa AKIYAMA
12
13 This code is free software; you can redistribute it and/or
14 modify it under the terms of the GNU Lesser General Public
15 License as published by the Free Software Foundation; either
16 version 3 of the License, or (at your option) any later version.
17
18 This library is distributed in the hope that it will be useful,
19 but WITHOUT ANY WARRANTY; without even the implied warranty of
20 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
21 Lesser General Public License for more details.
22
23 You should have received a copy of the GNU Lesser General Public
24 License along with this library; if not, write to the Free Software
25 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
26
27 *EndCopyright:
28 */
29
31
32#ifndef RCSC_COMMON_FREEFORM_MESSAGE_H
33#define RCSC_COMMON_FREEFORM_MESSAGE_H
34
35#include <memory>
36#include <string>
37#include <iostream>
38
39namespace rcsc {
40
41/*-------------------------------------------------------------------*/
47public:
48
50 typedef std::shared_ptr< const FreeformMessage > Ptr;
51
52private:
53
54 const std::string M_type;
55
56 // not used
57 FreeformMessage() = delete;
58 FreeformMessage( const FreeformMessage & ) = delete;
59 FreeformMessage & operator=( const FreeformMessage & ) = delete;
60
61protected:
62
66 FreeformMessage( const std::string & t )
67 : M_type( t )
68 { }
69
70public:
71
75 virtual
76 ~FreeformMessage() = default;
77
82 const std::string & type() const
83 {
84 return M_type;
85 }
86
91 virtual
92 int length() const = 0;
93
99 virtual
100 bool append( std::string & to ) const = 0;
101
107 virtual
108 std::ostream & printDebug( std::ostream & os ) const = 0;
109
110};
111
112}
113
114#endif
abstract freeform message.
Definition: freeform_message.h:46
std::shared_ptr< const FreeformMessage > Ptr
pointer type
Definition: freeform_message.h:50
virtual ~FreeformMessage()=default
virtual destructor.
virtual bool append(std::string &to) const =0
pure virtual method. append the freeform message to 'to'.
virtual int length() const =0
pure virtual method. get the length of this message
virtual std::ostream & printDebug(std::ostream &os) const =0
pure virtual method. output a debug message.
const std::string & type() const
pure virtual method. get the message type strring.
Definition: freeform_message.h:82
FreeformMessage(const std::string &t)
protected constructer.
Definition: freeform_message.h:66