UniSet  2.6.0
Extensions.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 Extensions_H_
00018 #define Extensions_H_
00019 // -------------------------------------------------------------------------
00020 #include <string>
00021 #include "UniXML.h"
00022 #include "Debug.h"
00023 #include "UniSetTypes.h"
00024 #include "Calibration.h"
00025 // -------------------------------------------------------------------------
00026 namespace uniset
00027 {
00028 //--------------------------------------------------------------------------
00029 namespace extensions
00030 {
00032 uniset::ObjectId getSharedMemoryID();
00033 
00034 xmlNode* findNode( xmlNode* node, const std::string& snode, const std::string& field );
00035 
00036 xmlNode* getCalibrationsSection();
00037 
00041 void escape_string( std::string& s );
00042 
00044 Calibration* buildCalibrationDiagram( const std::string& dname );
00045 
00046 void on_sigchild( int sig );
00047 
00048 std::shared_ptr<DebugStream> dlog();
00049 }
00050 // -------------------------------------------------------------------------
00051 // "синтаксический сахар"..для логов
00052 #define dinfo if( uniset::extensions::dlog()->debugging(Debug::INFO) ) uniset::extensions::dlog()->info()
00053 #define dwarn if( uniset::extensions::dlog()->debugging(Debug::WARN) ) uniset::extensions::dlog()->warn()
00054 #define dcrit if( uniset::extensions::dlog()->debugging(Debug::CRIT) ) uniset::extensions::dlog()->crit()
00055 #define dlog1 if( uniset::extensions::dlog()->debugging(Debug::LEVEL1) ) uniset::extensions::dlog()->level1()
00056 #define dlog2 if( uniset::extensions::dlog()->debugging(Debug::LEVEL2) ) uniset::extensions::dlog()->level1()
00057 #define dlog3 if( uniset::extensions::dlog()->debugging(Debug::LEVEL3) ) uniset::extensions::dlog()->level3()
00058 #define dlog4 if( uniset::extensions::dlog()->debugging(Debug::LEVEL4) ) uniset::extensions::dlog()->level4()
00059 #define dlog5 if( uniset::extensions::dlog()->debugging(Debug::LEVEL5) ) uniset::extensions::dlog()->level5()
00060 #define dlog6 if( uniset::extensions::dlog()->debugging(Debug::LEVEL6) ) uniset::extensions::dlog()->level6()
00061 #define dlog7 if( uniset::extensions::dlog()->debugging(Debug::LEVEL7) ) uniset::extensions::dlog()->level7()
00062 #define dlog8 if( uniset::extensions::dlog()->debugging(Debug::LEVEL8) ) uniset::extensions::dlog()->level8()
00063 #define dlog9 if( uniset::extensions::dlog()->debugging(Debug::LEVEL9) ) uniset::extensions::dlog()->level9()
00064 #define dlogsys if( uniset::extensions::dlog()->debugging(Debug::SYSTEM) ) uniset::extensions::dlog()->system()
00065 #define dlogrep if( uniset::extensions::dlog()->debugging(Debug::REPOSITORY) ) uniset::extensions::dlog()->repository()
00066 #define dlogany uniset::extensions::dlog()->any()
00067 // --------------------------------------------------------------------------
00068 } // end of namespace uniset
00069 // -------------------------------------------------------------------------
00070 
00071 #endif // Extensions_H_
00072 // -------------------------------------------------------------------------