Debian Codegraph @

src/mas/any.h

raw symbols SCIP
1 /***************************************************************************
2 any.h - description
3 -------------------
4 begin : nov 29th 2005
5 copyright : (C) 2005-2010 by Duong Khang NGUYEN
6 email : neoneurone @ gmail com
7 author : Victor STINNER
8
9 $Id: any.h 448 2010-05-09 15:18:32Z neoneurone $
10 ***************************************************************************/
11
12 /***************************************************************************
13 * *
14 * This program is free software; you can redistribute it and/or modify *
15 * it under the terms of the GNU General Public License as published by *
16 * the Free Software Foundation; either version 2 of the License, or *
17 * any later version. *
18 * *
19 ***************************************************************************/
20
21
22 #ifndef _OPENCITY_MAS_ANY_H_
23 #define _OPENCITY_MAS_ANY_H_ 1
24
25 #include <string>
26
27
28 typedef enum {
29 ANY_INT = 0,
30 ANY_UINT,
31 ANY_DOUBLE,
32 ANY_STRING
33 } MAS_ANY_TYPE;
34
35
36 /*=====================================================================*/
37 /** Any class is used to serialize data in order to send message from
38 an agent to another
39 @author Victor STINNER
40 */
41 class Any
42 {
43 public:
44 explicit Any(int value);
45 explicit Any(unsigned int value);
46 explicit Any(double value);
47 explicit Any(const std::string& value);
48
49 MAS_ANY_TYPE getType() const;
50 int getInt() const;
51 unsigned int getUInt() const;
52 double getDouble() const;
53 const std::string& getString() const;
54
55 friend std::ostream& operator<<(std::ostream& os, const Any& any);
56
57 private:
58 MAS_ANY_TYPE _type;
59 int _intValue;
60 unsigned int _uintValue;
61 double _doubleValue;
62 std::string _stringValue;
63 };
64
65 #endif