#include <PsOutput.h>
Inheritance diagram for PsOutput< Type >:


Public Methods | |
| PsOutput (const PsName &outputName, PsSimulatedObject &owner, const int historySize, PsPolatorNT *polator=NULL) | |
| Constructor. | |
| virtual | ~PsOutput (void) |
| Destructor. | |
| virtual const Type & | get (int &distanceToExactValue, const int precisionLevel, const PsDate &deltaT, Type &calculatedResult) const |
| get a value for this output | |
| virtual const Type & | getLastExactValue () const |
| get the last exact value produced and stored in this output | |
| virtual const PsDate & | getDateOfLastExactValue () const |
| get the date of the last exact value produced and stored in this output | |
| virtual void | set (const Type &newValue) |
| publish a new value through this output | |
| virtual void | suggest (const Type &suggestedValue) |
| used by an input to suggest an initial value if none has yet been produced | |
| virtual Type & | getNextPlaceHolder () |
| get a reference to the next place that will be used to store a value. | |
| virtual void | setInPlace (const Type &) |
| zero copy set for values wich have been calculated using the reference obtained by getNextPlaceHolder | |
| virtual void | connectedMyself (PsInputNT *input) |
| called by an input when it connects to this output | |
| virtual void | disconnectedMyself (PsInputNT *input) |
| called by an input when it disconnects from this output | |
| virtual void | printDebuggingInformation (ostream &err) const |
| print debugging info | |
| void | printHistory () const |
| print all the stored values | |
| virtual void | empty () |
| empty all the stored values | |
coding and decoding the output values from and to streams | |
| virtual void | extract (istream &=cin) |
| extract new values from a stream | |
| virtual void | insertInStream (ostream &=cout) const |
| insert latest value in a stream | |
| virtual void | pack (PsOutgoingSynchronisationMessage &) const |
| pack value in a PvmMessage ( should be delegated to a pvm output ) packs the name of the output, then any usefull update information | |
| virtual void | packAllValues (PsOutgoingSynchronisationMessage &) const |
| pack value in a PvmMessage ( should be delegated to a pvm output ) packs the name of the output, then all initial information | |
| virtual void | unpack (PsIncomingSynchronisationMessage &) |
| unpack value from a PvmMessage ( should be delegated to a pvm output ) shouldn't unpack the name, but all other usefull information packed | |
| virtual void | unpackAllValues (PsIncomingSynchronisationMessage &) |
| unpack value from a PvmMessage ( should be delegated to a pvm output ) shouldn't unpack the name, but all other usefull information packed | |
alias management | |
| virtual void | setUsedOutput (PsOutput< Type > *output) |
| change the output read by internal get | |
| virtual void | setAlias (PsOutputAlias< Type > *output) |
| set the direct alias of this output | |
| virtual void | unsetAlias () |
| cancel aliasing | |
| virtual PsOutput< Type > * | getUsedOutput (void) const |
| get the output used by internal get | |
| virtual PsOutputAlias< Type > * | getAlias (void) const |
| get the direct alias of this output | |
Public Attributes | |
| PsPolator< Type > * | _polator |
| the associated polator | |
Protected Methods | |
| virtual void | setValidity (bool) |
| setValidity. | |
| virtual void | notifyConnectedSensitiveInputs () |
| alert any sensitive input of a change of value | |
| virtual const Type & | localGet (int &validiteRes, const int niveauInterpol, const PsDate &deltaT, Type &resultPlaceHolder) const |
| this is the get that accesses the local history fifo, whether the output is aliased or not | |
| virtual void | localInsert (ostream &=cout) const |
| an insert that changes the local history fifo | |
Protected Attributes | |
| PsOutputAlias< Type > * | _aliasOfOutput |
| a pointer to the primary alias of this output | |
| PsOutput< Type > * | _usedOutput |
| the output read by get | |
| PsnAbstractFifo< Type > * | _history |
| the history storing fifo | |
| const PsDate & | _date |
| a reference to the current date | |
| list< PsSensitiveInput< Type > * > | _listOfConnectedSensitiveInputs |
| the list of connected sensitive inputs | |
| list< PsInput< Type > * > | _listOfConnectedUnsensitiveInputs |
| the list of connected unsensitive inputs | |
| bool | _sensitiveInputsConnected |
| a boolean indicating is sensible inputs are connected | |
| PsnMutexLock | _myMutex |
| A mutual exclusion lock to protect local data from corruption in a multithreaded environment Need to be protected : _listOfConnectedSensitiveInputs, outputAsc. | |
| bool | _validity |
| a boolean indicating presence of values in the fifo | |
Friends | |
| class | PsOutputAlias< Type > |
| friend declaration so thah aliases can notify the sensitive inputs connected to their aliased output | |
template parameter must be of a derived class of PsType
Definition at line 53 of file PsOutput.h.
|
||||||||||||||||||||||||
|
Constructor.
Definition at line 262 of file PsOutput.h. References PsOutput< Type >::_history, PsOutput< Type >::_polator, PsOutput< Type >::_usedOutput, and PsAttribute::getName().
00267 : PsAttribute(owner, outputName), 00268 PsOutputNT (owner, outputName), 00269 _aliasOfOutput ( NULL ), 00270 _date ( owner.getController().getSimulatedDate() ), 00271 _sensitiveInputsConnected ( false ), 00272 _validity ( false ) 00273 { 00274 /* thread safety assessement : 00275 thread safe because only on construction of the object 00276 */ 00277 00278 00279 #ifdef _DEBUGTYPEUTIL 00280 cout << "PsOutput<Type>::PsOutput () constructor" << endl; 00281 #endif 00282 00283 if ( polator == NULL ) 00284 // tous les types ont une methode static qui crait leur polator par defaut 00285 { 00286 Type aTypeInstance ; // because createPolator isn't static 00287 00288 _polator = static_cast<PsPolator <Type> *>(aTypeInstance.createPolator()) ; 00289 00290 if ( _polator==NULL ) 00291 { 00292 cerr<<"PsOutput<"<<typeid(Type).name()<<">::PsOutput : the created polator of " 00293 <<typeid(aTypeInstance).name()<<" isn't of type PsPolator <"<<typeid(Type).name()<<"> *"<<endl; 00294 } 00295 } 00296 else 00297 { 00298 _polator = dynamic_cast<PsPolator <Type> *>(polator) ; 00299 00300 if (_polator==NULL) 00301 { 00302 cerr<<"PsOutput<"<<typeid(Type).name()<<">::PsOutput : the created polator of type " 00303 <<typeid(polator).name()<<" isn't of type PsPolator <"<<typeid(Type).name()<<"> *"<<endl; 00304 } 00305 } 00306 if (_polator==NULL) 00307 { 00308 cerr<<"PsOutput<"<<typeid(Type).name()<<">::PsOutput : problem in creating the appropriate polator for output "<<getName()<<endl; 00309 } 00310 00311 // calculate the appropriate history fifo length 00312 00313 int realSize = historyLength + _polator->getNumberOfNeededValuesForMaxPrecisionPolation(); 00314 00315 _history = new PsnFifo < Type > (realSize) ; 00316 00317 _polator->setFifo(_history); 00318 00319 _usedOutput = this ; 00320 |
|
||||||||||
|
Destructor.
Definition at line 325 of file PsOutput.h. References PsOutput< Type >::_aliasOfOutput, PsOutput< Type >::_history, PsOutput< Type >::_listOfConnectedSensitiveInputs, PsOutput< Type >::_listOfConnectedUnsensitiveInputs, PsOutput< Type >::_myMutex, list< PsInput< Type > * >::begin(), list< PsSensitiveInput< Type > * >::begin(), list< PsInput< Type > * >::end(), list< PsSensitiveInput< Type > * >::end(), PsnMutexLock::protect(), and PsnMutexLock::unprotect().
00327 {
00328 /* thread safety assessement :
00329 thread safe because only one destruction of the object
00330 */
00331
00332 #ifdef _TYPENAMENOTIMPLICIT
00333 typename
00334 #endif
00335 list<PsSensitiveInput <Type> *>::iterator i;
00336
00337 _myMutex.protect() ;
00338
00339 for (i = _listOfConnectedSensitiveInputs.begin();
00340 i != _listOfConnectedSensitiveInputs.end();
00341 i++)
00342 {
00343 (*i)->outputDestroyed();
00344 }
00345
00346 #ifdef _TYPENAMENOTIMPLICIT
00347 typename
00348 #endif
00349 list<PsInput <Type> *>::iterator j;
00350
00351 for (j = _listOfConnectedUnsensitiveInputs.begin();
00352 j != _listOfConnectedUnsensitiveInputs.end();
00353 j++)
00354 {
00355 (*j)->outputDestroyed();
00356 }
00357
00358 _myMutex.unprotect() ;
00359
00360 if ( _aliasOfOutput != NULL ) _aliasOfOutput->aliasedOutputDeleted () ;
00361
00362 if ( _history != NULL ) delete _history ;
|
|
||||||||||
|
called by an input when it connects to this output
Implements PsOutputNT. Definition at line 521 of file PsOutput.h. References PsOutput< Type >::_listOfConnectedSensitiveInputs, PsOutput< Type >::_listOfConnectedUnsensitiveInputs, PsOutput< Type >::_myMutex, PsOutput< Type >::_sensitiveInputsConnected, PsnMutexLock::protect(), list< PsInput< Type > * >::push_back(), list< PsSensitiveInput< Type > * >::push_back(), PsAttribute::touch(), and PsnMutexLock::unprotect().
00522 {
00523
00524 /* thread safety assessement :
00525 critical data is mutex protected
00526 */
00527 touch() ;
00528 PsSensitiveInput <Type> * inputSensible=dynamic_cast< PsSensitiveInput <Type> *>(input);
00529 if (inputSensible!=NULL)
00530 {
00531 #ifdef _DEBUGALIAS
00532 cerr<<"PsOutput<Type>::connectedMyself"<<input<<endl;
00533 #endif
00534 _myMutex.protect () ;
00535
00536 _listOfConnectedSensitiveInputs.push_back(inputSensible);
00537
00538 _sensitiveInputsConnected = true ;
00539
00540 _myMutex.unprotect () ;
00541 }
00542 else
00543 {
00544 _myMutex.protect () ;
00545
00546 PsInput<Type> * standardInput = dynamic_cast<PsInput<Type> *> (input) ;
00547
00548 assert (standardInput != NULL ) ;
00549 _listOfConnectedUnsensitiveInputs.push_back ( standardInput ) ;
00550
00551 _myMutex.unprotect () ;
00552 }
|
|
||||||||||
|
called by an input when it disconnects from this output
Implements PsOutputNT. Definition at line 556 of file PsOutput.h. References PsOutput< Type >::_listOfConnectedSensitiveInputs, PsOutput< Type >::_listOfConnectedUnsensitiveInputs, PsOutput< Type >::_myMutex, PsOutput< Type >::_sensitiveInputsConnected, list< PsSensitiveInput< Type > * >::empty(), PsnMutexLock::protect(), list< PsInput< Type > * >::remove(), list< PsSensitiveInput< Type > * >::remove(), and PsnMutexLock::unprotect().
00557 {
00558 #ifdef _DEBUGALIAS
00559 cerr<<"PsOutput<Type>::disconnectedMyself"<<endl;
00560 #endif
00561
00562 /* thread safety assessement :
00563 critical data is mutex protected
00564 */
00565
00566 PsSensitiveInput <Type> * inputSensible=dynamic_cast< PsSensitiveInput <Type> *>(input);
00567
00568 if (inputSensible!=NULL)
00569 {
00570
00571 _myMutex.protect () ;
00572
00573 _listOfConnectedSensitiveInputs.remove(inputSensible);
00574
00575 if ( _listOfConnectedSensitiveInputs.empty() ) _sensitiveInputsConnected = false ;
00576
00577 _myMutex.unprotect () ;
00578
00579 }
00580 else
00581 {
00582
00583 _myMutex.protect () ;
00584
00585 PsInput <Type> * unsensitiveInput = dynamic_cast< PsInput <Type> *>(input);
00586
00587 _listOfConnectedUnsensitiveInputs.remove(unsensitiveInput);
00588
00589 _myMutex.unprotect () ;
00590
00591 }
|
|
|||||||||
|
empty all the stored values
Definition at line 812 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::_owner, PsAttribute::getName(), and PsOutput< Type >::setValidity().
00813 {
00814 /* thread safety assessement :
00815 as thread safe as clear of fifo. Only one simultaneous acces possible (in theory).
00816 */
00817 // MIPSPRO 7.3.1.2 workaround
00818 static PsSensitiveInput<Type> toto (getName(), _owner, false) ;
00819 _history->clear () ;
00820 setValidity(false) ;
|
|
||||||||||
|
extract new values from a stream
Implements PsAttribute. Reimplemented in PsMomeOutput< Type >. Definition at line 632 of file PsOutput.h. References PsOutput< Type >::_history, PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::setValidity().
00633 {
00634
00635 /* thread safety assessement :
00636 localGet and extract could collide. Thread safety can only be assured if the fifo and the interpolator are thread safe with respect to the values in the fifo.
00637 only one extract at a time.
00638 */
00639
00640 if (_validity)
00641 {
00642 const Type & oldValue=_history->getPreceedingValue(0);
00643 in >> *_history ;
00644 if(_history->getPreceedingValue(0)!=oldValue) //double extract won't happen
00645 {
00646 notifyConnectedSensitiveInputs();
00647 }
00648 }
00649 else
00650 {
00651 in >> *_history ;
00652 setValidity(true) ;
00653 notifyConnectedSensitiveInputs();
00654 }
|
|
||||||||||||||||||||||||
|
get a value for this output
Reimplemented in PsMomeOutput< Type >, and PsNullOutput< Type >. Definition at line 439 of file PsOutput.h. References PsOutput< Type >::_history, PsOutput< Type >::getUsedOutput(), and PsDate. Referenced by PsMomeOutput< Type >::get().
00444 {
00445 /* thread safety assessement :
00446 As thread safe as localGet
00447 */
00448 #ifdef _DEBUGTYPEUTIL
00449 cerr<<"PsOutput<Type>::get"<<endl;
00450 cerr<<"OutputUtilisée : "<<getUsedOutpute()<<endl;
00451 cerr<<"file : "<<_history<<endl;
00452 _history->printDebuggingInformation() ;
00453 informations();
00454 #endif
00455 assert( getUsedOutput () != NULL ) ;
00456 return getUsedOutput ()->localGet(validiteRes,niveauInterpol,deltaT,resultPlaceHolder);
|
|
||||||||||
|
get the direct alias of this output
Definition at line 427 of file PsOutput.h. References PsOutput< Type >::_aliasOfOutput. Referenced by PsOutput< Type >::printDebuggingInformation().
00429 {
00430 /* thread safety assessement :
00431 protected method
00432 multiple simultaneous access possible, but as long as this method is only used onced by each access patern, the PsOuptut stays coherant
00433 */
00434 return _aliasOfOutput ;
|
|
|||||||||
|
get the date of the last exact value produced and stored in this output
Reimplemented in PsNullOutput< Type >. Definition at line 843 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::_owner, PsName::getCString(), PsSimulatedObject::getName(), HeapStackTop::getSystemMemoryManager(), PsDate, and PsAttribute::touch().
00845 {
00846 touch() ;
00847 // this bypasses any Polator
00848 if (_history->getNumberOfPresentValues(1) >= 1 ) //if a value is stored
00849 {
00850 return _history->getPreceedingDate ( 0 ) ;
00851 }
00852 else
00853 {
00854 HeapStackTop usualContext(HeapStackTop::getSystemMemoryManager() );
00855 PsUnInitialisedOutputException exception(*this,"PsOutput<Type>::getLastExactValue\n");
00856 exception<<"Impossible to get a value from an uninitialised output of "<<_owner.getName().getCString();
00857 throw exception;
00858 }
|
|
|||||||||
|
get the last exact value produced and stored in this output
Reimplemented in PsNullOutput< Type >. Definition at line 824 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::_owner, PsName::getCString(), PsSimulatedObject::getName(), HeapStackTop::getSystemMemoryManager(), and PsAttribute::touch().
00826 {
00827 touch() ;
00828 // this bypasses any Polator
00829 if (_history->getNumberOfPresentValues(1) >= 1 ) //if a value is stored
00830 {
00831 return _history->getPreceedingValue ( 0 ) ;
00832 }
00833 else
00834 {
00835 HeapStackTop usualContext(HeapStackTop::getSystemMemoryManager());
00836 PsUnInitialisedOutputException exception(*this,"PsOutput<Type>::getLastExactValue\n");
00837 exception<<"Impossible to get a value from an uninitialised output of "<<_owner.getName().getCString();
00838 throw exception;
00839 }
|
|
|||||||||
|
get a reference to the next place that will be used to store a value. Using the obtained reference enables a zero copy set (using setInPlace) if the new value is directly calculated using that reference. Definition at line 862 of file PsOutput.h. References PsOutput< Type >::_history.
00864 {
00865 return _history->getNextPlaceHolder() ;
|
|
||||||||||
|
get the output used by internal get
Definition at line 414 of file PsOutput.h. References PsOutput< Type >::_usedOutput. Referenced by PsOutput< Type >::get(), PsOutput< Type >::insertInStream(), and PsOutput< Type >::printDebuggingInformation().
00416 {
00417 /* thread safety assessement :
00418 protected method
00419 multiple simultaneous access possible, but as long as this method is only used onced by each access patern, the PsOuptut stays coherant
00420 */
00421 return _usedOutput ;
|
|
||||||||||
|
insert latest value in a stream
Implements PsAttribute. Definition at line 755 of file PsOutput.h. References PsOutput< Type >::getUsedOutput().
00756 {
00757 /*thread safety assessement :
00758 As thread safe as localInsert
00759 */
00760 cerr<<"PsOutput<Type>::insertInStream"<<endl;
00761 getUsedOutput()->localInsert(out);
|
|
||||||||||||||||||||||||
|
this is the get that accesses the local history fifo, whether the output is aliased or not
Definition at line 461 of file PsOutput.h. References PsAttribute::_owner, PsOutput< Type >::_polator, PsOutput< Type >::_validity, PsSimulatedObject::getController(), PsController::getSimulatedDate(), HeapStackTop::getSystemMemoryManager(), PsDate, and PsAttribute::touch().
00466 {
00467 /* thread safety assessement :
00468 As thread safe as polate from PsInterplateur. But be careful : in a multithreaded environment this member function can generate more exceptions than expected
00469 */
00470 touch() ;
00471 if (!_validity)
00472 {
00473 HeapStackTop usualContext( HeapStackTop::getSystemMemoryManager() );
00474 PsUnInitialisedOutputException exception(*this,"PsOutput<Type>::localGet \n");
00475 throw exception;
00476 }
00477 else
00478 {
00479 #ifdef _DEBUGTYPEUTIL
00480 cerr<<"PsOutput<Type>::localGet"<<endl;
00481 cerr<<owner.getController().getSimulatedDate()<<endl;
00482 cerr<<"Interpolateur : "<<_polator<<endl;
00483 #endif
00484 PsDate date = _owner.getController().getSimulatedDate() - deltaT ;
00485 return _polator->polate(niveauInterpol, date,validiteRes, resultPlaceHolder);
00486 }
|
|
||||||||||
|
an insert that changes the local history fifo
Definition at line 765 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::_owner, PsOutput< Type >::_validity, PsName::getCString(), PsSimulatedObject::getName(), and HeapStackTop::getSystemMemoryManager().
00766 {
00767 /* thread safety assement
00768 thread safe : collides with set on the PsnAbstractFifo. But they should only be activated by the owner. So as lmong as the owner isn't multithreaded...
00769 nota : in a multithreaded environment this member function could generate more exceptions than expected
00770 */
00771 if (!_validity)
00772 {
00773 HeapStackTop usualContext(HeapStackTop::getSystemMemoryManager() );
00774 PsUnInitialisedOutputException exception(*this,"PsOutput<Type>::localInsert\n");
00775 exception<<"Cannot read uninitailised output of "<<_owner.getName().getCString();
00776 throw exception;
00777 }
00778 else
00779 {
00780 out << *_history << " " ;
00781 }
|
|
|||||||||
|
alert any sensitive input of a change of value
Reimplemented in PsOutputAlias< Type >. Definition at line 489 of file PsOutput.h. References PsOutput< Type >::_listOfConnectedSensitiveInputs, PsOutput< Type >::_myMutex, list< PsSensitiveInput< Type > * >::begin(), list< PsSensitiveInput< Type > * >::end(), PsnMutexLock::protect(), PsAttribute::touch(), and PsnMutexLock::unprotect(). Referenced by PsOutput< Type >::extract(), PsOutputAlias< Type >::notifyConnectedSensitiveInputs(), PsOutput< Type >::set(), PsOutput< Type >::setInPlace(), PsOutput< Type >::suggest(), PsOutput< Type >::unpack(), and PsOutput< Type >::unpackAllValues().
00490 {
00491
00492 /* thread safety assessement :
00493 mutex protected
00494 */
00495 if ( _sensitiveInputsConnected )
00496 {
00497 // with sensitive inputs connected, it is as if the output value was read at each step
00498 touch() ;
00499 #ifdef _TYPENAMENOTIMPLICIT
00500 typename
00501 #endif
00502 list<PsSensitiveInput <Type> *>::iterator i;
00503
00504 _myMutex.protect() ;
00505
00506 for (i=_listOfConnectedSensitiveInputs.begin() ;
00507 i!=_listOfConnectedSensitiveInputs.end() ;
00508 i++ ) {
00509 #ifdef _DEBUGALIAS
00510 cerr<<"PsOutput<Type>::notifyConnectedSensitiveInputs : one to notify"<<endl;
00511 #endif
00512 (*i)->signalChange();
00513 #ifdef _DEBUGALIAS
00514 cerr<<"PsOutput<Type>::notifyConnectedSensitiveInputs : one notified"<<endl;
00515 #endif
00516 }
00517 _myMutex.unprotect() ;
00518 }
|
|
||||||||||
|
pack value in a PvmMessage ( should be delegated to a pvm output ) packs the name of the output, then any usefull update information
Reimplemented from PsFlowable. Definition at line 657 of file PsOutput.h. References PsOutput< Type >::_history, PsOutgoingSynchronisationMessage::getMessageDate(), PsAttribute::getName(), and PsName::pack().
00659 {
00660 //cerr<<"PsOutput<Type>::pack"<<endl;
00661 //packs the name of the output, then any usefull information
00662 /* thread safety assement
00663 thread safe : collides with set and localInsert on the PsnAbstractFifo. But they should only be activated by the owner. So as long as the owner isn't multithreaded...
00664 nota : in a multithreaded environment this member function could generate more exceptions than expected
00665 */
00666 if (_validity)
00667 {
00668 if ( out.getMessageDate() == _history->getPreceedingDate ( 0 ) )
00669 {
00670 getName ().pack ( out ) ;
00671 _history->pack( out ) ;
00672 }
00673 }
00674 //else : do not pack anything, therefore mirror will remain uninitialised
00675 // cerr<<"PsOutput<Type>:"<<this<<":pack done"<<endl;
|
|
||||||||||
|
pack value in a PvmMessage ( should be delegated to a pvm output ) packs the name of the output, then all initial information
Implements PsOutputNT. Definition at line 680 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::getName(), and PsName::pack().
00682 {
00683 //cerr<<"PsOutput<Type>::packAllValues"<<endl;
00684 //packs the name of the output, then all initial information
00685 /* thread safety assement
00686 thread safe : collides with set and localInsert on the PsnAbstractFifo. But they should only be activated by the owner. So as long as the owner isn't multithreaded, or that the kernel doesn't call this member function during activation of the owner...
00687 nota : in a multithreaded environment this member function could generate more exceptions than expected
00688 */
00689 if (_validity)
00690 {
00691 getName ().pack ( out ) ;
00692 _history->packAllValues( out ) ;
00693 }
00694 //else : do not pack anything, therefore mirror will remain uninitialised
00695 // cerr<<"PsOutput<Type>:"<<this<<":packAllVAlues done"<<endl;
|
|
||||||||||
|
print debugging info
Implements PsAttribute. Definition at line 794 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::_name, PsAttribute::_owner, PsOutput< Type >::getAlias(), PsSimulatedObject::getName(), and PsOutput< Type >::getUsedOutput().
00796 {
00797 /* thread safety assessement :
00798 const method : thread safe. shown value may not be a coherant image of an PsOutput
00799 */
00800 err << "**********************************************************" << endl;
00801 err << "Class PsOutput" << endl;
00802 err << "Owner : " << _owner.getName () << endl;
00803 err << "Output Name : "<< _name <<endl;
00804 err << "Type of output : "<< typeid(Type).name() << endl ;
00805 err << "Output primary alias : " << getAlias() << endl ;
00806 err << "Used Output : " << getUsedOutput () << endl ;
00807 err << "History Fifo: "<<_history <<endl;
|
|
|||||||||
|
print all the stored values
Definition at line 784 of file PsOutput.h. References PsOutput< Type >::_history.
00785 {
00786 /* thread safety assessement :
00787 const method : should be thread safe if printDebuggingInformation of PsnAbstractFifo is thread safe
00788 */
00789 _history->printDebuggingInformation () ;
|
|
||||||||||
|
publish a new value through this output
Reimplemented in PsMomeOutput< Type >. Definition at line 596 of file PsOutput.h. References PsOutput< Type >::_date, PsOutput< Type >::_history, PsAttribute::_owner, PsSimulatedObject::getController(), PsnCurrentActiveObject::getCurrentActiveObject(), PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::setValidity(). Referenced by PsMomeOutput< Type >::set().
00598 {
00599
00601 assert (&_owner == PsnCurrentActiveObject::getCurrentActiveObject() ||
00602 PsnCurrentActiveObject::getCurrentActiveObject() == & _owner.getController() ||
00603 PsnCurrentActiveObject::getCurrentActiveObject() == NULL ) ;
00604
00605 /* thread safety assessement :
00606 localGet and set could collide. Thread safety can only be assured if the fifo and the interpolator are thread safe with respect to the value in the fifo.
00607 only one set at a time.
00608 */
00609
00610 if (_validity)
00611 {
00612 const Type & oldValue = _history->getPreceedingValue(0);
00613 if( newValue != oldValue ) //comparaison has to be done before the set, because we're working on references and that there can be a double set (bug corrected by D. Margery)
00614 {
00615 _history->set ( newValue, _date) ;
00616 notifyConnectedSensitiveInputs() ;
00617 }
00618 else
00619 {
00620 _history->set ( newValue, _date) ;
00621 }
00622 }
00623 else {
00624 _history->set (newValue, _date) ;
00625 setValidity(true) ;
00626 notifyConnectedSensitiveInputs();
00627 }
|
|
||||||||||
|
set the direct alias of this output
Definition at line 403 of file PsOutput.h. References PsOutput< Type >::_aliasOfOutput. Referenced by PsOutputAlias< Type >::alias(), and PsOutputAlias< Type >::PsOutputAlias().
00405 {
00406 /* thread safety assessement :
00407 multiple simultaneous access possible, but they don't compromise thread safety : last one out wins
00408 */
00409 _aliasOfOutput = output ;
|
|
||||||||||
|
zero copy set for values wich have been calculated using the reference obtained by getNextPlaceHolder
Definition at line 869 of file PsOutput.h. References PsOutput< Type >::_date, PsOutput< Type >::_history, PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::setValidity().
00871 {
00872
00873 if (_validity)
00874 {
00875 const Type & oldValue = _history->getPreceedingValue(0);
00876
00877 if( newValue != oldValue) //comparaison has to be done before setInPlace, because there can be a double setInPlace and we're working on references (bug corrected by D. Margery)
00878 {
00879 _history->setInPlace ( newValue, _date ) ;
00880 notifyConnectedSensitiveInputs();
00881 }
00882 else
00883 {
00884 _history->setInPlace ( newValue, _date ) ;
00885 }
00886 }
00887 else
00888 {
00889 _history->setInPlace ( newValue, _date) ;
00890 setValidity(true) ;
00891 notifyConnectedSensitiveInputs();
00892 }
|
|
||||||||||
|
change the output read by internal get
Reimplemented in PsMomeOutput< Type >, and PsOutputAlias< Type >. Definition at line 367 of file PsOutput.h. References PsOutput< Type >::_usedOutput. Referenced by PsOutputAlias< Type >::alias(), PsOutputAlias< Type >::PsOutputAlias(), PsOutputAlias< Type >::setUsedOutput(), PsMomeOutput< Type >::setUsedOutput(), and PsOutput< Type >::unsetAlias().
00369 {
00370 /* thread safety assessement :
00371 multiple simultaneous access possible, and doesn't compromise thread safety : last one out wins
00372 */
00373
00374 _usedOutput = output ;
|
|
||||||||||
|
setValidity. change the validity of the output Reimplemented in PsMomeOutput< Type >. Definition at line 379 of file PsOutput.h. References PsOutput< Type >::_validity. Referenced by PsOutput< Type >::empty(), PsOutput< Type >::extract(), PsOutput< Type >::set(), PsOutput< Type >::setInPlace(), PsMomeOutput< Type >::setValidity(), PsOutput< Type >::suggest(), PsOutput< Type >::unpack(), and PsOutput< Type >::unpackAllValues().
00380 {
00381 /* thread safety assessement :
00382 protected method, used to change protected member : thread safety should be insured by callers
00383 */
00384
00385 _validity = b ;
|
|
||||||||||
|
used by an input to suggest an initial value if none has yet been produced
Definition at line 896 of file PsOutput.h. References PsOutput< Type >::_history, PsAttribute::_owner, PsOutput< Type >::_validity, PsSimulatedObject::getController(), PsController::getSimulatedDate(), PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::setValidity().
00898 {
00899 if (!_validity)
00900 {
00901 _history->set ( newValue , _owner.getController ().getSimulatedDate () ) ;
00902 setValidity(true) ;
00903 notifyConnectedSensitiveInputs();
00904 }
|
|
||||||||||
|
unpack value from a PvmMessage ( should be delegated to a pvm output ) shouldn't unpack the name, but all other usefull information packed
Reimplemented from PsFlowable. Definition at line 700 of file PsOutput.h. References PsOutput< Type >::_history, PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::setValidity().
00702 {
00703 // shouldn't unpack the name, but all other usefull information packed
00704 /* thread safety assessement :
00705 localGet and extract could collide. Thread safety can only be assured if the fifo and the interpolator are thread safe with respect to the values in the fifo.
00706 only one extract at a time.
00707 */
00708
00709 if (_validity)
00710 {
00711 const Type & oldValue = _history->getPreceedingValue(0);
00712 _history->unpack ( in ) ;
00713 if(_history->getPreceedingValue(0) != oldValue) //double extract won't happen
00714 {
00715 notifyConnectedSensitiveInputs();
00716 }
00717 }
00718 else
00719 {
00720 _history->unpack ( in ) ;
00721 setValidity(true) ;
00722 notifyConnectedSensitiveInputs() ;
00723 }
|
|
||||||||||
|
unpack value from a PvmMessage ( should be delegated to a pvm output ) shouldn't unpack the name, but all other usefull information packed
Implements PsOutputNT. Definition at line 728 of file PsOutput.h. References PsOutput< Type >::_history, PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::setValidity().
00730 {
00731 // shouldn't unpack the name, but all other usefull information packed
00732 /* thread safety assessement :
00733 localGet and extract could collide. Thread safety can only be assured if the fifo and the interpolator are thread safe with respect to the values in the fifo.
00734 only one extract at a time.
00735 */
00736
00737 if (_validity)
00738 {
00739 // only in the case a suggested values was given at connection
00740 const Type & oldValue = _history->getPreceedingValue(0);
00741 _history->unpackAllValues ( in ) ;
00742 if(_history->getPreceedingValue(0) != oldValue) //double extract won't happen
00743 {
00744 notifyConnectedSensitiveInputs();
00745 }
00746 }
00747 else
00748 {
00749 _history->unpackAllValues ( in ) ;
00750 setValidity(true) ;
00751 }
|
|
|||||||||
|
cancel aliasing
Reimplemented in PsOutputAlias< Type >. Definition at line 390 of file PsOutput.h. References PsOutput< Type >::_aliasOfOutput, and PsOutput< Type >::setUsedOutput(). Referenced by PsOutputAlias< Type >::unsetAlias().
00392 {
00393 /* thread safety assessement :
00394 multiple simultaneous access possible, but they don't compromise thread safety : last one out wins
00395 */
00396 _aliasOfOutput = NULL ;
00397 setUsedOutput ( this ) ;
|
|
|||||
|
friend declaration so thah aliases can notify the sensitive inputs connected to their aliased output
Definition at line 204 of file PsOutput.h. |
|
|||||
|
a pointer to the primary alias of this output
Definition at line 220 of file PsOutput.h. Referenced by PsOutput< Type >::getAlias(), PsOutput< Type >::setAlias(), PsOutput< Type >::unsetAlias(), and PsOutput< Type >::~PsOutput(). |
|
|||||
|
a reference to the current date
Definition at line 229 of file PsOutput.h. Referenced by PsOutput< Type >::set(), and PsOutput< Type >::setInPlace(). |
|
|||||
|
|||||
|
the list of connected sensitive inputs
Definition at line 237 of file PsOutput.h. Referenced by PsOutput< Type >::connectedMyself(), PsOutput< Type >::disconnectedMyself(), PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::~PsOutput(). |
|
|||||
|
the list of connected unsensitive inputs
Definition at line 240 of file PsOutput.h. Referenced by PsOutput< Type >::connectedMyself(), PsOutput< Type >::disconnectedMyself(), and PsOutput< Type >::~PsOutput(). |
|
|||||
|
A mutual exclusion lock to protect local data from corruption in a multithreaded environment Need to be protected : _listOfConnectedSensitiveInputs, outputAsc.
Definition at line 248 of file PsOutput.h. Referenced by PsOutput< Type >::connectedMyself(), PsOutput< Type >::disconnectedMyself(), PsOutput< Type >::notifyConnectedSensitiveInputs(), and PsOutput< Type >::~PsOutput(). |
|
|||||
|
the associated polator
Definition at line 233 of file PsOutput.h. Referenced by PsOutput< Type >::localGet(), PsMomeOutput< Type >::PsMomeOutput(), and PsOutput< Type >::PsOutput(). |
|
|||||
|
a boolean indicating is sensible inputs are connected
Definition at line 243 of file PsOutput.h. Referenced by PsOutput< Type >::connectedMyself(), and PsOutput< Type >::disconnectedMyself(). |
|
|||||
|
the output read by get
Definition at line 223 of file PsOutput.h. Referenced by PsOutput< Type >::getUsedOutput(), PsOutput< Type >::PsOutput(), and PsOutput< Type >::setUsedOutput(). |
|
|||||
|
a boolean indicating presence of values in the fifo
Definition at line 251 of file PsOutput.h. Referenced by PsMomeOutput< Type >::extract(), PsMomeOutput< Type >::get(), PsOutput< Type >::localGet(), PsOutput< Type >::localInsert(), PsOutput< Type >::setValidity(), and PsOutput< Type >::suggest(). |
| Documentation generated on Mon Nov 25 15:26:17 2002 |
Generated with doxygen 1.2.12 by Dimitri van Heesch , 1997-2001 |