All Classes Functions Variables Properties
List of all members | Public Member Functions
CCWFGM_WeatherStation Class Reference

Class CCWFGM WeatherStation. More...

#include <CWFGM_WeatherStation.h>

Collaboration diagram for CCWFGM_WeatherStation:
Collaboration graph

Public Member Functions

STDMETHOD() Clone (ICWFGM_WeatherStation **newWeatherStation)
 
STDMETHOD() MT_Lock (USHORT exclusive, USHORT obtain)
 
STDMETHOD() GetStreamCount (ULONG *count)
 
STDMETHOD() AddStream (ICWFGM_WeatherStream *stream, ULONG index)
 
STDMETHOD() RemoveStream (ICWFGM_WeatherStream *stream)
 
STDMETHOD() StreamAtIndex (ULONG index, ICWFGM_WeatherStream **stream)
 
STDMETHOD() IndexOfStream (ICWFGM_WeatherStream *stream, ULONG *index)
 
STDMETHOD() GetAttribute (USHORT option, VARIANT *value)
 
STDMETHOD() SetAttribute (USHORT option, VARIANT value)
 
STDMETHOD() get_UserData (VARIANT *pVal)
 
STDMETHOD() put_UserData (VARIANT newVal)
 
- Public Member Functions inherited from ICWFGM_WeatherStation
HRESULT MT_Lock ([in] unsigned short exclusive, [in] unsigned short obtain)
 
HRESULT Clone ([out]ICWFGM_WeatherStation **newWeatherStation)
 
HRESULT GetStreamCount ([out, retval]unsigned long *count)
 
HRESULT AddStream ([in]ICWFGM_WeatherStream *stream, [in]unsigned long index)
 
HRESULT RemoveStream ([in]ICWFGM_WeatherStream *stream)
 
HRESULT StreamAtIndex ([in]unsigned long index, [out, retval]ICWFGM_WeatherStream **stream)
 
HRESULT IndexOfStream ([in]ICWFGM_WeatherStream *stream, [out, retval]unsigned long *index)
 
HRESULT GetAttribute ([in]unsigned short option, [out, retval] VARIANT *value)
 
HRESULT SetAttribute ([in]unsigned short option, [in] VARIANT value)
 

Additional Inherited Members

- Properties inherited from ICWFGM_WeatherStation
VARIANT UserData [get, set]
 

Detailed Description

Class CCWFGM WeatherStation.

This object maintains a collection of weather streams. A variety of streams may co-exist to provide a useful comparison of results in different scenarios. It also supports the standard COM IPersistStream, IPersistStreamInit, and IPersistStorage interfaces. Any weather stream is automatically saved with the station in order to simplify serialization operations in the client application.

A weather stream must be associated with a station before being attached to a scenario.

Member Function Documentation

CCWFGM_WeatherStation::AddStream ( ICWFGM_WeatherStream stream,
ULONG  index 
)

Adds a weather stream to this weather station. This stream may be in any state (initialized, newly created, or containing data). Any calculated data in the weather stream will be marked invalid to use the location and time zone of this weather station.

Parameters
streamA weather stream object.
indexIndex (0-based) for where to insert the stream into the set.
See Also
ICWFGM_WeatherStation::AddStream
Return values
S_OKSuccessful.
E_OUTOFMEMORY
Insufficientmemory.
E_NOINTERFACEThe object trying to be added (stream) doesn't support the correct interfaces, or if the pointer is invalid.
ERROR_WEATHER_STREAM_ALREADY_ADDEDIf the stream being added is already associated with this station.
ERROR_WEATHER_STREAM_ALREADY_ASSIGNEDThe stream is already attached to a weather station (a stream can only be associated with a single weather station at a time).
ERROR_WEATHER_STREAM_UNKNOWNThe weather stream indexed could not be found.
ERROR_SCENARIO_SIMULATION_RUNNINGCannot add stream while the simulation is running.
CCWFGM_WeatherStation::Clone ( ICWFGM_WeatherStation **  newWeatherStation)

Creates a new weather station with all the same properties of the object being called, returns a handle to the new object in 'newWeatherStation'. Any weather streams associated with this object are also duplicated for the new station.

Parameters
newWeatherStationA weather station object.
See Also
ICWFGM_WeatherStation::Clone
Return values
S_OKSuccessful.
E_POINTERThe address provided for newWeatherStation is invalid.
E_OUTOFMEMORYInsufficient memory.
ERROR_SEVERITY_WARNINGFile error or an unspecified failure.
E_NOINTERFACECorrect interface is not supported.
CCWFGM_WeatherStation::get_UserData ( VARIANT *  pVal)

This property is unused by this object, and is available for exclusive use by the client code. It is a VARIANT value to ensure that the client code can store a pointer value (if it chooses) for use in manual subclassing this object. This value is not loaded or saved during serialization operations, and it is the responsibility of the client code to manage any value or object stored here. Access to this property is not thread-safe.

Parameters
pValValue of UserData
See Also
ICWFGM_WeatherStation::UserData
Return values
E_POINTERThe address provided for pVal is invalid
S_OKSuccessful
CCWFGM_WeatherStation::GetAttribute ( USHORT  option,
VARIANT *  value 
)

Gets the value of an "option" and saves it in the "value" variable provided.

Parameters
optionThe option that you want the value of (Longitude, Latitude or Elevation). Valid values are:
  • CWFGM_GRID_ATTRIBUTE_LATITUDE 64-bit floating point, radians.
  • CWFGM_GRID_ATTRIBUTE_LONGITUDE 64-bit floating point, radians.
  • CWFGM_GRID_ATTRIBUTE_DEFAULT_ELEVATION 64-bit floating point, metres. User specified elevation to use when there is no grid elevation available for at a requested grid location.
  • CWFGM_ATTRIBUTE_LOAD_WARNING BSTR. Any warnings generated by the COM object when deserializating.
valueA pointer to a variable that you want the value to be saved in.
See Also
ICWFGM_WeatherStation::GetAttribute
Return values
E_POINTERThe address provided for value is invalid.
S_OKSuccessful.
E_INVALIDARGInvalid arguments were passed.
CCWFGM_WeatherStation::GetStreamCount ( ULONG *  count)

Returns the number of streams associated with this weather station. Any number of streams can be associated with a given weather station and be assigned different values, options, and time ranges. However, only one stream from a station can be associated with a scenario at a given time.

Parameters
countNumber of streams.
See Also
ICWFGM_WeatherStation::GetStreamCount
Return values
E_POINTERThe address provided for count is invalid.
S_OKSuccessful.
CCWFGM_WeatherStation::IndexOfStream ( ICWFGM_WeatherStream stream,
ULONG *  index 
)

Returns the index of 'stream' in this station's set of streams.

Parameters
streamA weather stream object.
indexThe index of stream.
See Also
ICWFGM_WeatherStation::IndexOfStream
Return values
E_POINTERThe address provided for stream or index is invalid.
S_OKSuccessful.
ERROR_WEATHER_STREAM_UNKNOWNStream is unknown to this weather station.
CCWFGM_WeatherStation::MT_Lock ( USHORT  exclusive,
USHORT  obtain 
)

Changes the state of the object with respect to access rights. When the object is used by an active simulation, it must not be modified. When the object is somehow modified, it must be done so in an atomic action to prevent concerns with arising from multithreading. Note that these locks are primarily needed to ensure that data contributing during a simulation is not modified while the simulation is executing.

All routines in the ICWFGM_GridEngine interface are necessarily NOT multithreading safe (for performance) but other interfaces for a given COM object implementing this interface must be by specification.

In the event of an error, then locking is undone to reflect an error state.

Parameters
exclusiveTRUE if the requester wants a write lock, false for read/shared access
obtainTRUE to obtain the lock, FALSE to release the lock. If this is FALSE, then the 'exclusive' parameter must match the initial call used to obtain the lock.
See Also
ICWFGM_WeatherStation::MT_Lock
Return values
SUCCESS_STATE_OBJECT_UNLOCKEDLock was released.
SUCCESS_STATE_OBJECT_LOCKED_WRITEExclusive/write lock obtained.
SUCCESS_STATE_OBJECT_LOCKED_SCENARIOA scenario successfully required a lock for purposes of simulating.
SUCCESS_STATE_OBJECT_LOCKED_READShared/read lock obtained.
S_OKSuccessful
CCWFGM_WeatherStation::put_UserData ( VARIANT  newVal)

This property is unused by this object, and is available for exclusive use by the client code. It is a VARIANT value to ensure that the client code can store a pointer value (if it chooses) for use in manual subclassing this object. This value is not loaded or saved during serialization operations, and it is the responsibility of the client code to manage any value or object stored here. Access to this property is not thread-safe.

Parameters
newValReplacement value for UserData
See Also
ICWFGM_WeatherStation::UserData
Return values
S_OKSuccessful
CCWFGM_WeatherStation::RemoveStream ( ICWFGM_WeatherStream stream)

Removes an association between a weather stream and this weather station.

Parameters
streamA weather stream object.
See Also
ICWFGM_WeatherStation::RemoveStream
Return values
E_POINTERThe address provided for stream is invalid.
S_OKSuccessful.
ERROR_WEATHER_STREAM_UNKNOWNThe client program tried to remove a stream object that is unknown to this station object.
ERROR_SCENARIO_SIMULATION_RUNNINGCannot remove a stream while it is used in a running scenario.
CCWFGM_WeatherStation::SetAttribute ( USHORT  option,
VARIANT  value 
)

Sets the value of an "option" to the value of the "value" variable provided.

Parameters
optionThe option that you want the value of (Longitude, Latitude or Default Elevation). Valid values are:
  • CWFGM_GRID_ATTRIBUTE_LATITUDE 64-bit floating point, radians.
  • CWFGM_GRID_ATTRIBUTE_LONGITUDE 64-bit floating point, radians.
  • CWFGM_GRID_ATTRIBUTE_DEFAULT_ELEVATION 64-bit floating point, metres. User specified elevation to use when there is no grid elevation available for at a requested grid location.
valueThe new value for the "option"
See Also
ICWFGM_WeatherStation::SetAttribute
Return values
E_POINTERThe address provided for value is invalid.
S_OKSuccessful.
E_INVALIDARGInvalid arguments were passed.
ERROR_SCENARIO_SIMULATION_RUNNINGCannot change attributes while a scenario is running.
E_FAILFailed.
CCWFGM_WeatherStation::StreamAtIndex ( ULONG  index,
ICWFGM_WeatherStream **  stream 
)

Given an index value, returns a pointer to a specific stream associated with this station.

Parameters
indexIndex to a weather stream
streamAddress to contain the specific requested weather stream.
See Also
ICWFGM_WeatherStation::StreamAtIndex
Return values
E_POINTERThe address provided for stream is invalid.
S_OKSuccessful.
ERROR_WEATHER_STREAM_UNKNOWNThe index is out of range.