1 // protocol.hxx -- High level protocal class
3 // Written by Curtis Olson, started November 1999.
5 // Copyright (C) 1999 Curtis L. Olson - curt@flightgear.org
7 // This program is free software; you can redistribute it and/or
8 // modify it under the terms of the GNU General Public License as
9 // published by the Free Software Foundation; either version 2 of the
10 // License, or (at your option) any later version.
12 // This program is distributed in the hope that it will be useful, but
13 // WITHOUT ANY WARRANTY; without even the implied warranty of
14 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 // General Public License for more details.
17 // You should have received a copy of the GNU General Public License
18 // along with this program; if not, write to the Free Software
19 // Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
28 #include <simgear/compiler.h>
29 #include <simgear/io/iochannel.hxx>
38 #define FG_MAX_MSG_SIZE 16384
49 // string protocol_str;
51 // char buf[FG_MAX_MSG_SIZE];
61 virtual ~FGProtocol();
64 virtual bool process();
67 inline SGProtocolDir get_direction() const { return dir; }
68 void set_direction( const string& d );
70 inline double get_hz() const { return hz; }
71 inline void set_hz( double t ) { hz = t; }
72 inline int get_count_down() const { return count_down; }
73 inline void set_count_down( int c ) { count_down = c; }
74 inline void dec_count_down( int c ) { count_down -= c; }
76 virtual bool gen_message();
77 virtual bool parse_message();
79 // inline string get_protocol() const { return protocol_str; }
80 // inline void set_protocol( const string& str ) { protocol_str = str; }
82 // inline char *get_buf() { return buf; }
83 // inline int get_length() const { return length; }
84 // inline void set_length( int l ) { length = l; }
86 inline bool is_enabled() const { return enabled; }
87 inline void set_enabled( const bool b ) { enabled = b; }
89 inline SGIOChannel *get_io_channel() const { return io; }
90 inline void set_io_channel( SGIOChannel *c ) { io = c; }
94 typedef vector < FGProtocol * > io_container;
95 typedef io_container::iterator io_iterator;
96 typedef io_container::const_iterator const_io_iterator;
99 SG_USING_STD(invalid_argument);
101 //namespace flightgear { namespace network {
102 class FGProtocolConfigError : public invalid_argument
105 FGProtocolConfigError( const string& what_string )
106 : invalid_argument(what_string) {}
108 //}} // end namespace flightgear::network
111 #endif // _PROTOCOL_HXX