Main Page | Modules | Namespace List | Class Hierarchy | Alphabetical List | Class List | File List | Namespace Members | Class Members | File Members | Related Pages

FridgeControl Class Reference
[ACS Components Examples]

#include <acsexmplFridgeImpl.h>

Inheritance diagram for FridgeControl:

Inheritance graph
[legend]
Collaboration diagram for FridgeControl:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 FridgeControl (const ACE_CString &name, maci::ContainerServices *containerServices)
virtual ~FridgeControl ()
virtual void cleanUp ()
void updateTemperature ()
virtual void on ()
virtual void off ()
virtual void open ()
virtual void close ()
virtual ACS::RWdouble_ptr refTemperature ()
virtual FRIDGE::ROOnOffStates_ptr powerStatus ()
virtual FRIDGE::ROOpClStates_ptr doorStatus ()
virtual ACS::ROdouble_ptr currTemperature ()

Private Member Functions

virtual void loadData ()
void operator= (const FridgeControl &)

Private Attributes

baci::SmartPropertyPointer<
baci::RWdouble
m_refTemperature_sp
baci::SmartPropertyPointer<
ROEnumImpl< ACS_ENUM_T(FRIDGE::OnOffStates),
POA_FRIDGE::ROOnOffStates > 
m_powerStatus_sp )
baci::SmartPropertyPointer<
ROEnumImpl< ACS_ENUM_T(FRIDGE::OpClStates),
POA_FRIDGE::ROOpClStates > 
m_doorStatus_sp )
baci::SmartPropertyPointer<
baci::ROdouble
m_currTemperature_sp
FridgeThreadm_controlLoop_p
nc::SimpleSupplierm_FridgeSupplier_p

Detailed Description

FridgeControl shows BACI threads as well as a notification channel supplier. The class FridgeControl simulates the behaviour of a fridge. It provides four synchronous methods: on, off, open, and close. It also provides the properties: refTemperature, powerStatus, doorStatus, and currTemperature. powerStatus and doorStatus are both enums. Finally, FridgeControl is also a Supplier for the "fridge" notification channel.
Author:
Matej Sekoranja, Jozef Stefan Institute, Slovenia
Version:
"@(#) $Id: acsexmplFridgeImpl.h,v 1.115 2008/10/01 04:30:47 cparedes Exp $"


Constructor & Destructor Documentation

FridgeControl::FridgeControl const ACE_CString &  name,
maci::ContainerServices containerServices
 

Constructor

Parameters:
poa Poa which will activate this and also all other components.
name component's name. This is also the name that will be used to find the configuration data for the component in the Configuration Database.

virtual FridgeControl::~FridgeControl  )  [virtual]
 

Destructor


Member Function Documentation

virtual void FridgeControl::cleanUp  )  [virtual]
 

Called after the last functional call to the component has finished. The component should then orderly release resources etc.

As required by the CharacteristicComponentImpl class, I call explicitly the cleanUp() of the parent class. This makes sure that all threads are stopped and the Component's state set. Depending on what resources are used by a class implementing a Component and by the implementation of the parent class (if it does not inherit directly from acscomponent::ACSComponentImpl or baci:: CharacteristicComponentImpl) it might be necessary to call the cleanuUp() method of the base class AFTER having released resources allocated by the current class. This is demonstrated in this example where we want to make sure that the powerStatus is FRIDGE::OFF before letting the cleanUp() of the base class stopping all the threads, including the one that regulates the temperature. For an example where the cleanUp() of the parent class is called before any other step, see the Building class. Always check the documentation of the parent class and consider what resources are allocated by this class to extablish the requirements for the execution of lifecycle chained methods.

Returns:
void

Reimplemented from acscomponent::ACSComponentImpl.

virtual void FridgeControl::close  )  [virtual]
 

Close the door.

Returns:
void

virtual ACS::ROdouble_ptr FridgeControl::currTemperature  )  [virtual]
 

Property currTemperature shows the fridge's actual temperature.

Returns:
Reference to the BACI property

virtual FRIDGE::ROOpClStates_ptr FridgeControl::doorStatus  )  [virtual]
 

Property doorStatus shows the position of the door.

Returns:
Reference to the BACI property

virtual void FridgeControl::loadData  )  [private, virtual]
 

Converts this devices useful data into a temperatureDataBlockEvent structure and then publishes that onto an event channel.

Returns:
void

virtual void FridgeControl::off  )  [virtual]
 

Turn off the fridge.

Returns:
void

virtual void FridgeControl::on  )  [virtual]
 

Turn on the fridge.

Returns:
void

virtual void FridgeControl::open  )  [virtual]
 

Open the door.

Returns:
void

void FridgeControl::operator= const FridgeControl  )  [private]
 

ALMA C++ coding standards state copy operators should be disabled.

virtual FRIDGE::ROOnOffStates_ptr FridgeControl::powerStatus  )  [virtual]
 

Property powerStatus shows whether the power is on or off.

Returns:
Reference to the BACI property

virtual ACS::RWdouble_ptr FridgeControl::refTemperature  )  [virtual]
 

Property refTemperature is like a thermostat for the fridge.

Returns:
Reference to the BACI property

void FridgeControl::updateTemperature  ) 
 

Updates the temperature from the physical device

Returns:
void


Member Data Documentation

FridgeThread* FridgeControl::m_controlLoop_p [private]
 

m_controlLoop_p is only started once the fridge has been turned on(). This thread is used to simulate the fridge's temperature trying to reach equillibrium with the reference temperature. Once the fridge has been turned off(), this thread is suspended.

baci::SmartPropertyPointer<baci::ROdouble> FridgeControl::m_currTemperature_sp [private]
 

m_currTemperature_p is the temperature the fridge actually is.

baci::SmartPropertyPointer< ROEnumImpl<ACS_ENUM_T(FRIDGE::OpClStates), POA_FRIDGE::ROOpClStates> FridgeControl::m_doorStatus_sp) [private]
 

The fridge's door can be either opened or closed.

nc::SimpleSupplier* FridgeControl::m_FridgeSupplier_p [private]
 

This is the Supplier derived class used to publish data to the event channel.

baci::SmartPropertyPointer<ROEnumImpl< ACS_ENUM_T(FRIDGE::OnOffStates), POA_FRIDGE::ROOnOffStates> FridgeControl::m_powerStatus_sp) [private]
 

The fridge can be either turned on or off.

baci::SmartPropertyPointer<baci::RWdouble> FridgeControl::m_refTemperature_sp [private]
 

m_refTemperature_sp is the temperature we want the fridge to be.


The documentation for this class was generated from the following file:
Generated on Thu Apr 30 02:36:27 2009 for ACS C++ API by doxygen 1.3.8