Main Page   Namespace List   Class Hierarchy   Alphabetical List   Compound List   File List   Compound Members   File Members  

PsOutputNT.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 "PsOutputNT.h"
00019 #include "PsInputNT.h"
00020 #include <PsSimulatedObject.h>
00021 
00022 
00023 PsOutputNT::PsOutputNT (PsSimulatedObject & owner, const PsName & outputName) : 
00024    PsAttribute ( owner , outputName ) 
00025 {
00026   
00027 }
00028 
00029 
00030 PsOutputNT::~PsOutputNT () 
00031 {
00032 
00033 }
00034 
00035 bool PsOutputNT::connect (const PsName & objectName, const PsName & inputName )
00036 {
00037    bool result;
00038 
00039    PsSimulatedObject * object = _owner.getController ().getPointerToSimulatedObjectNamed (objectName) ;
00040 
00041    if (object != NULL) 
00042       {
00043          result = connect ( *object, inputName ) ;
00044       } 
00045    else 
00046       {
00047          result = false ;
00048 #ifdef _USESSTREAM
00049          ostringstream warningMessage ;
00050          warningMessage<<"For output "<<getName()<<" of object "<<_owner.getName()<<endl;
00051          warningMessage<<"PsOutputNT::connect impossible because object "<<objectName<<" cannot be found"<<endl;
00052          PsController::warning (warningMessage.str(), PsController::SomeWarnings) ;
00053 #else
00054          ostrstream warningMessage ;
00055          warningMessage<<"For output "<<getName()<<" of object "<<_owner.getName()<<endl;
00056          warningMessage<<"PsOutputNT::connect impossible because object "<<objectName<<" cannot be found"<<endl;
00057          warningMessage.put ('\0') ;
00058          PsController::warning (warningMessage.str(), PsController::SomeWarnings) ;
00059          delete warningMessage.str() ;
00060 #endif
00061       }
00062    return result ;
00063 }
00064 
00065 
00066 bool PsOutputNT::connect (PsSimulatedObject & object, const PsName & inputName )
00067 {
00068    PsInputNT * input = object.getPointerToInputNamed(inputName) ;
00069    if ( input!= NULL )
00070       {
00071 #ifdef _USESSTREAM
00072          ostringstream warningMessage ;
00073          warningMessage<<"For output "<<getName()<<" of object "<<_owner.getName()<<endl;
00074          warningMessage<<"PsOutputNT::connect impossible because input "<<inputName<<"of object "<<object.getName()<<"doesn't exist"<<endl;
00075          PsController::warning (warningMessage.str(), PsController::SomeWarnings) ;
00076 #else
00077          ostrstream warningMessage ;
00078          warningMessage<<"For output "<<getName()<<" of object "<<_owner.getName()<<endl;
00079          warningMessage<<"PsOutputNT::connect impossible because input "<<inputName<<"of object "<<object.getName()<<"doesn't exist"<<endl;
00080          warningMessage.put ('\0') ;
00081          PsController::warning (warningMessage.str(), PsController::SomeWarnings) ;
00082          delete warningMessage.str() ;
00083 #endif 
00084          return input->realConnect (this) ;
00085       }
00086    else
00087       {
00088          return false ;
00089       }
00090 }
00091 
00092 bool PsOutputNT::connect (PsSimulatedObject * pointerToObject, const PsName & inputName )
00093 {
00094    bool result;
00095    
00096    if ( pointerToObject != NULL )
00097       {
00098          result = connect (*pointerToObject, inputName ) ;
00099       }
00100    else
00101       {
00102          result = false ;
00103 #ifdef _USESSTREAM
00104          ostringstream warningMessage ;
00105          warningMessage<<"For output "<<getName()<<" of object "<<_owner.getName()<<endl;
00106          warningMessage<<"PsOutputNT::connect impossible because the pointer to the owner of the input is nil"<<endl;
00107          PsController::warning (warningMessage.str(), PsController::SomeWarnings) ;
00108 #else
00109          ostrstream warningMessage ;
00110          warningMessage<<"For output "<<getName()<<" of object "<<_owner.getName()<<endl;
00111          warningMessage<<"PsOutputNT::connect impossible because the pointer to the owner of the input is nil"<<endl;
00112          warningMessage.put ('\0') ;
00113          PsController::warning (warningMessage.str(), PsController::SomeWarnings) ;
00114          delete warningMessage.str() ;
00115 #endif
00116       }
00117    return result ;
00118 }
00119 
00120 
00121 
00122 
00123 
00124 
00125 

logo OpenMask

Documentation generated on Mon Nov 25 15:25:02 2002

Generated with doxygen 1.2.12 by Dimitri van Heesch ,   1997-2001