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>
37 #define FG_MAX_MSG_SIZE 16384
39 // forward declaration
52 // string protocol_str;
54 // char buf[FG_MAX_MSG_SIZE];
64 virtual ~FGProtocol();
67 virtual bool process();
70 inline SGProtocolDir get_direction() const { return dir; }
71 inline void set_direction( const string& d ) {
74 } else if ( d == "out" ) {
76 } else if ( d == "bi" ) {
83 inline double get_hz() const { return hz; }
84 inline void set_hz( double t ) { hz = t; }
85 inline int get_count_down() const { return count_down; }
86 inline void set_count_down( int c ) { count_down = c; }
87 inline void dec_count_down( int c ) { count_down -= c; }
89 virtual bool gen_message();
90 virtual bool parse_message();
92 // inline string get_protocol() const { return protocol_str; }
93 // inline void set_protocol( const string& str ) { protocol_str = str; }
95 // inline char *get_buf() { return buf; }
96 // inline int get_length() const { return length; }
97 // inline void set_length( int l ) { length = l; }
99 inline bool is_enabled() const { return enabled; }
100 inline void set_enabled( const bool b ) { enabled = b; }
102 inline SGIOChannel *get_io_channel() const { return io; }
103 inline void set_io_channel( SGIOChannel *c ) { io = c; }
107 typedef vector < FGProtocol * > io_container;
108 typedef io_container::iterator io_iterator;
109 typedef io_container::const_iterator const_io_iterator;
112 #endif // _PROTOCOL_HXX