UniSet  2.6.0
UTypes.h
00001 /*
00002  * Copyright (c) 2015 Pavel Vainerman.
00003  *
00004  * This program is free software: you can redistribute it and/or modify
00005  * it under the terms of the GNU Lesser General Public License as
00006  * published by the Free Software Foundation, version 2.1.
00007  *
00008  * This program is distributed in the hope that it will be useful, but
00009  * WITHOUT ANY WARRANTY; without even the implied warranty of
00010  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
00011  * Lesser General Lesser Public License for more details.
00012  *
00013  * You should have received a copy of the GNU Lesser General Public License
00014  * along with this program. If not, see <http://www.gnu.org/licenses/>.
00015  */
00016 // -------------------------------------------------------------------------
00017 #ifndef UTypes_H_
00018 #define UTypes_H_
00019 // --------------------------------------------------------------------------
00020 #include <string>
00021 #include "Configuration.h"
00022 #include "UniSetTypes.h"
00023 // --------------------------------------------------------------------------
00024 namespace UTypes
00025 {
00026 const long DefaultID = uniset::DefaultObjectId;
00027 const long DefaultSupplerID = uniset::AdminID;
00028 
00029 struct Params
00030 {
00031     static const int max = 20;
00032 
00033     Params(): argc(0)
00034     {
00035         memset(argv, 0, sizeof(argv));
00036     }
00037 
00038     bool add( char* s )
00039     {
00040         if( argc < Params::max )
00041         {
00042             argv[argc++] = uniset::uni_strdup(s);
00043             return true;
00044         }
00045 
00046         return false;
00047     }
00048 
00049     bool add_str( const std::string s )
00050     {
00051         if( argc < Params::max )
00052         {
00053             argv[argc++] = uniset::uni_strdup(s);
00054             return true;
00055         }
00056 
00057         return false;
00058     }
00059 
00060     int argc;
00061     char* argv[max];
00062 
00063     static Params inst()
00064     {
00065         return Params();
00066     }
00067 };
00068 
00069 struct ShortIOInfo
00070 {
00071     long value;
00072     unsigned long tv_sec;
00073     unsigned long tv_nsec;
00074     long supplier;
00075     long supplier_node;
00076 };
00077 }
00078 
00079 //---------------------------------------------------------------------------
00080 #endif
00081 //---------------------------------------------------------------------------