OMKTracer.cpp

Go to the documentation of this file.
00001 /***************************************************************************
00002  *   Copyright (C) 2006 by Benoit Chanclou,bunraku   *
00003  *   bchanclo@irisa.fr   *
00004  *                                                                         *
00005  *   This program is free software; you can redistribute it and/or modify  *
00006  *   it under the terms of the GNU General Public License as published by  *
00007  *   the Free Software Foundation; either version 2 of the License, or     *
00008  *   (at your option) any later version.                                   *
00009  *                                                                         *
00010  *   This program is distributed in the hope that it will be useful,       *
00011  *   but WITHOUT ANY WARRANTY; without even the implied warranty of        *
00012  *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the         *
00013  *   GNU General Public License for more details.                          *
00014  *                                                                         *
00015  *   You should have received a copy of the GNU General Public License     *
00016  *   along with this program; if not, write to the                         *
00017  *   Free Software Foundation, Inc.,                                       *
00018  *   59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.             *
00019  ***************************************************************************/
00020 
00021 #include "OMKTracer.h"
00022 #include "OMKSimulatedObject.h"
00023 #include "OMKExtension.h"
00024 #include "OMKIAttribute.h"
00025 #include "OMKExtensibleSimulatedObject.h"
00026 #include <iostream>
00027 #include <fstream>
00028 
00029 using namespace OMK ;
00030 using namespace OBT ;
00031 
00032 //-----------------------------------------------------------------------------
00033 TracerIdTmp::TracerIdTmp( const char* id ) 
00034 :
00035 _unregisterId( Singleton< Tracer >::getInstance().registerId( id ) )
00036 {
00037         if ( _unregisterId ) 
00038         {
00039                 _id = id ;
00040         }
00041 }
00042 //-----------------------------------------------------------------------------
00043 TracerIdTmp::~TracerIdTmp() 
00044 {
00045   if ( _unregisterId ) 
00046   {
00047           Singleton< Tracer >::getInstance().unregisterId( _id.c_str() ) ; 
00048   }
00049 }
00050 //=============================================================================
00051 
00052 //-----------------------------------------------------------------------------
00053 std::string OMK::debugMsg( const SimulatedObject* obj ) 
00054 {
00055   std::ostringstream txt ;
00056   txt << "object \"" << (obj ? obj->getName().getString() : std::string( "null" ) ) << "\" (class "
00057     << (obj ? obj->getObjectDescriptor().getClass().getString() : std::string( "unknow" ) ) << ")" ;
00058   return txt.str() ;
00059 }
00060 
00061 //-----------------------------------------------------------------------------
00062 std::string OMK::debugMsg( const Extension* ext, ExtensibleSimulatedObject* obj ) 
00063 {
00064   std::ostringstream txt ;
00065   txt << "extension \"" << (ext ? ext->getId().getString() : std::string( "null" ) ) 
00066     << "\"" ;
00067   if( obj ) 
00068           txt << " of the " << OMK::debugMsg( obj ) ;
00069   else
00070     txt << " not include in an object" ;
00071   return txt.str() ;
00072 }
00073 
00074 //-----------------------------------------------------------------------------
00075 std::string OMK::debugMsg( const IAttribute* attr ) 
00076 {
00077   std::ostringstream txt ;
00078   txt << "attribute \"" << (attr ? attr->getId().getString() : std::string( "null" ) ) 
00079     << "\" (" << (attr ? attr->getTypeId().name() : "unknow" ) << " type)" << getAttrOwnerMsg( attr ) ;
00080   return txt.str() ;
00081 }
00082 
00083 //-----------------------------------------------------------------------------
00084 std::string OMK::getAttrOwnerMsg( const IAttribute* attr )
00085 {
00086   std::ostringstream txt ;
00087   if( attr ) 
00088   {
00089     if( attr->getOwner() ) 
00090       txt << " of " << debugMsg( attr->getOwner() ) ;
00091     else
00092       txt << " not include in an object" ;
00093   }
00094   return txt.str() ;
00095 }

logo OpenMask

Documentation generated on Mon Jun 9 11:45:57 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007