UniSet  2.6.0
UTypes.h
1 /*
2  * Copyright (c) 2015 Pavel Vainerman.
3  *
4  * This program is free software: you can redistribute it and/or modify
5  * it under the terms of the GNU Lesser General Public License as
6  * published by the Free Software Foundation, version 2.1.
7  *
8  * This program is distributed in the hope that it will be useful, but
9  * WITHOUT ANY WARRANTY; without even the implied warranty of
10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11  * Lesser General Lesser Public License for more details.
12  *
13  * You should have received a copy of the GNU Lesser General Public License
14  * along with this program. If not, see <http://www.gnu.org/licenses/>.
15  */
16 // -------------------------------------------------------------------------
17 #ifndef UTypes_H_
18 #define UTypes_H_
19 // --------------------------------------------------------------------------
20 #include <string>
21 #include "Configuration.h"
22 #include "UniSetTypes.h"
23 // --------------------------------------------------------------------------
24 namespace UTypes
25 {
26  const long DefaultID = uniset::DefaultObjectId;
27  const long DefaultSupplerID = uniset::AdminID;
28 
29  struct Params
30  {
31  static const int max = 20;
32 
33  Params(): argc(0)
34  {
35  memset(argv, 0, sizeof(argv));
36  }
37 
38  bool add( char* s )
39  {
40  if( argc < Params::max )
41  {
42  argv[argc++] = uniset::uni_strdup(s);
43  return true;
44  }
45 
46  return false;
47  }
48 
49  bool add_str( const std::string s )
50  {
51  if( argc < Params::max )
52  {
53  argv[argc++] = uniset::uni_strdup(s);
54  return true;
55  }
56 
57  return false;
58  }
59 
60  int argc;
61  char* argv[max];
62 
63  static Params inst()
64  {
65  return Params();
66  }
67  };
68 
69  struct ShortIOInfo
70  {
71  long value;
72  unsigned long tv_sec;
73  unsigned long tv_nsec;
74  long supplier;
75  long supplier_node;
76  };
77 }
78 
79 //---------------------------------------------------------------------------
80 #endif
81 //---------------------------------------------------------------------------
Definition: UTypes.h:24
const ObjectId AdminID
Definition: UniSetTypes.h:60
const ObjectId DefaultObjectId
Definition: UniSetTypes.h:56
Definition: UTypes.h:69
Definition: UTypes.h:29