OMKProcess.cxx

Go to the documentation of this file.
00001 /*
00002  * This file is part of openMask © INRIA, CNRS, Universite de Rennes 1 1993-2002, thereinafter the Software
00003  * 
00004  * The Software has been developped within the Siames Project. 
00005  * INRIA, the University of Rennes 1 and CNRS jointly hold intellectual property rights
00006  * 
00007  * The Software has been registered with the Agence pour la Protection des
00008  * Programmes (APP) under registration number IDDN.FR.001.510008.00.S.P.2001.000.41200
00009  *  
00010  * This file may be distributed under the terms of the Q Public License
00011  * version 1.0 as defined by Trolltech AS of Norway and appearing in the file
00012  * LICENSE.QPL included in the packaging of this file.
00013  *
00014  * Licensees holding valid specific licenses issued by INRIA, CNRS or Université de Rennes 1 
00015  * for the software may use this file in accordance with that specific license
00016  *
00017  */
00018 #include <cassert>
00019 #include <OMKProcess.h>
00020 #include <OMKSvmLink.h>
00021 #include "OMKController.h"
00022 using namespace OMK ;
00023 
00024 //-----------------------------------------------------------------------------
00025 Process::Process (const std::string & np, const std::string & mac)
00026   : Packable(),
00027     _dateOfLastMessage ( Controller::initialSimulationDate ), //why not ?
00028     _processName(np),
00029     _machineName(mac),
00030     _processFrequency (1), //give a stable point when calculing least common
00031     _maxHostedFrequency (0), //gives a stable point in calculating max
00032     // multiplier 
00034     _iterationFlag(0)
00036 {
00037    assert ( Controller::lcm ( 13 , 1 ) == 13 ) ; //make sure lcm implementation has 1 as stable point.
00038 }
00039 
00040 //-----------------------------------------------------------------------------
00041 
00042 Process::~Process () {
00043 
00044 }
00045 
00046 //-----------------------------------------------------------------------------
00047 
00048 void Process::pack (OutgoingSynchronisationMessage & out) const
00049 {
00050    _processName.pack(out) ;
00051    _svmLink->pack(out) ;
00052 }
00053 
00054 //-----------------------------------------------------------------------------
00055 
00056 void Process::unpack (IncomingSynchronisationMessage & in) 
00057 {
00058 #ifdef _DEBUGPVMMESS 
00059   std::cerr<<"Process::extract "<<std::endl;
00060 #endif
00061    in >> _processName >> *_svmLink ;
00062 
00063 #ifdef _DEBUGPVMMESS 
00064    std::cerr<<"process named "<<_processName<<std::endl;
00065 #endif
00066 }
00067 
00068 
00069 //-----------------------------------------------------------------------------
00070 
00071 const Name & Process::getProcessName () const 
00072 {
00073    return _processName ;
00074 }
00075  
00076 //-----------------------------------------------------------------------------
00077 
00078 const Name & Process::getHostMachineName () const 
00079 {
00080    return _machineName ;
00081 }
00082 
00083 
00084 //-----------------------------------------------------------------------------
00085 
00086 const Frequency & Process::getFrequency () const 
00087 {
00088   return _processFrequency ;
00089 }
00090 
00091 //-----------------------------------------------------------------------------
00092 
00093 const Frequency & Process::getMaxFrequencyOfHostedObjects () const 
00094 {
00095    return _maxHostedFrequency ;
00096 }
00097 
00098 //-----------------------------------------------------------------------------
00099 
00100 SvmLink * Process::getSvmLink () const 
00101 {
00102    return _svmLink ;
00103 }
00104 
00105 //-----------------------------------------------------------------------------
00106 
00107 void Process::setFrequency (const Frequency & val) 
00108 {
00109    _processFrequency = val ;
00110    _period = static_cast< double>( 1. / val ) ;
00111 }
00112 
00113 //-----------------------------------------------------------------------------
00114 
00115 void Process::setMaxHostedFrequency (const Frequency & val) 
00116 {
00117    _maxHostedFrequency = val ;
00118 } 
00119 
00120 //-----------------------------------------------------------------------------
00121 
00122 void Process::setSvmLink (SvmLink * val) 
00123 {
00124    _svmLink = val ;
00125 }
00126 
00127 
00128 
00129 void Process::setDateOfLastMessage ( const Date & d )
00130 {
00131    _dateOfLastMessage = d ;
00132 }
00133 
00134 
00135 
00136 const Date & Process::getDateOfLastMessage () const 
00137 {
00138    return _dateOfLastMessage ;
00139 }
00140 
00141 
00142 const Date & Process::getPeriod () const 
00143 {
00144    return _period ;
00145 }
00146 
00149 void Process::incrementeIterationFlag() 
00150 {
00151   _iterationFlag++;
00152 }
00153 
00154 int Process::getIterationFlag()
00155 {
00156   return _iterationFlag;
00157 }
00158 
00159 void Process::resetIterationFlag() 
00160 {
00161   _iterationFlag=0;
00162 }
00163 
00164 bool  Process::disconnectedProcess()
00165 {
00166   if( getIterationFlag() >= 50000)
00167     {return true;}
00168   else  return false;
00169 }
00170 

logo OpenMask

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

Generated with doxygen by Dimitri van Heesch ,   1997-2007