MOOCHO (Single Doxygen Collection)
Version of the Day
|
Iterface for information about Iteration Quantities. More...
#include <IterationPack_IterQuantity.hpp>
Classes | |
class | NoStorageAvailable |
Thrown memory if attempted to be set that storage can not be allocated to. More... | |
class | QuanityNotSet |
Thrown when memory access is attempted when it has not yet been updated. More... | |
Public types | |
enum | { NONE_UPDATED = INT_MIN } |
Constant for value returned when no iteration quantity has been updated. More... | |
Constructors, destructors and memory managment | |
virtual | ~IterQuantity () |
virtual IterQuantity * | clone () const =0 |
Misc query (const) methods | |
virtual const char * | name () const =0 |
Return the name (zero terminated string) of this quantity. More... | |
virtual bool | has_storage_k (int offset) const =0 |
Determine if there is storage advailable for the k offset iteration quanity. More... | |
virtual bool | updated_k (int offset) const =0 |
Determine if the quanity for the k offset iteration has been accessed by a call to set_k() (see IterQuantityAccess ). More... | |
virtual int | last_updated () const =0 |
Return the highest k such that updated_k(k) returns true. More... | |
virtual bool | will_loose_mem (int offset, int set_offset) const =0 |
Determine if the memory for the k + offset quantityy will be lost if set_k(set_offset) is called (see IterQuantityAccess ). More... | |
Misc modifier (non-const) methods | |
virtual void | set_not_updated_k (int offset)=0 |
Causes updated_k(k) to return false. More... | |
virtual void | set_all_not_updated ()=0 |
Causes updated_k(k) to return false for all k . More... | |
Iteration incrementation | |
virtual void | next_iteration ()=0 |
Shift the reference point from the k to the k+1 iteration. More... | |
Runtime information | |
virtual void | print_concrete_type (std::ostream &out) const =0 |
Print to an output stream a description of this iteration quantity. More... | |
Assert state | |
void | assert_has_storage_k (int offset) const |
Assert has_storage_k(offset) == true (throw NoStorageAvailable ). More... | |
void | assert_updated_k (int offset) const |
Assert updated_k(offset) == true (throw QuanityNotSet). More... | |
Iterface for information about Iteration Quantities.
This class provides and interface to all concrete types of iteration quantities and provides all of the services except storage access. It is assumed that every concrete iteration quantity subclass will will be derived from the tempalted interface class IterQuantityAccess
.
ToDo: Finish the documentation and give examples.
Definition at line 68 of file IterationPack_IterQuantity.hpp.
anonymous enum |
Constant for value returned when no iteration quantity has been updated.
Enumerator | |
---|---|
NONE_UPDATED |
Definition at line 75 of file IterationPack_IterQuantity.hpp.
|
inlinevirtual |
Definition at line 91 of file IterationPack_IterQuantity.hpp.
|
pure virtual |
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Return the name (zero terminated string) of this quantity.
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Determine if there is storage advailable for the k offset
iteration quanity.
If this function returns true then set_f(offset)
can be called to set the quanity for the kth iteration or get_k(offset)
(see IterQuantityAccess
) can be called if updated_k(offset)
is already true.
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Determine if the quanity for the k offset
iteration has been accessed by a call to set_k()
(see IterQuantityAccess
).
This function does not confirm that the k offset
quanity has been set to a meaningfull value, only that set_k()
was called to get a reference to that quanity and get_k()
can be called to get that same reference.
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Return the highest k such that updated_k(k)
returns true.
If updated_k(k) == false
false for all k
then this function will return NONE_UPDATED
.
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Determine if the memory for the k + offset
quantityy will be lost if set_k(set_offset)
is called (see IterQuantityAccess
).
This member function allows clients to know a little about the specific behavior of the subclass. Clients can use this function to determine if it is safe to call get_k(offset)
after set_k(set_offset)
is called. For example, imagine the case where you wanted to update a vector in iteration k+1 given the elements in the k iteraiton. For a subclass with only single storage (info.will_loose_mem(0,+1) == true
) the following code would not work:
For i
== 1, set_k(+1)
would cause a state transition and for i
== 2 info.get_k(0)
would throw an exception. Actually, the compiler may evaluate info.set_k(+1)
before info.get_k(0)
so info.get_k(0)
whould throw an exception right away for i
== 1.
If the client knows that only single storage is needed then it could use something like the following code:
In an actually implemention one would use temporary references and would not call set_k()
and get_k()
multiple times like this but you get the basic idea. The above code works for both single and multiple storage and will not result in any unnecessary copying since assingment to self should be detected. In the above code info.set_k(+1) = info.get_k(0);
is called to effect the state transistion.
On the other hand if you need dual storage you will need a temporary copy in the event that will_loose_mem(offset, set_offset)
returns true. For example you need dual storage for the code:
Even the above operation can be implemented without a temporary vector but you get the idea, the (i-1) quanity is modifed and is not the original for i > 2.
Preconditions:
updated_k(offset) == true
[throw QuanityNotSet
] Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Causes updated_k(k)
to return false.
Preconditions:
updated_k(offset) == true
[throw QuanityNotSet
] Postconditions:
updated_k(offset) == false
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Causes updated_k(k)
to return false for all k
.
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Shift the reference point from the k to the k+1 iteration.
Postcondtions:
updated_k(offset)
before the call equals updated_k(offset-1)
after return &this->get_k(offset)
for this->updated_k(offset) == true
before the call, equals &this->get_k(offset-1)
for this->updated_k(offset-1) == true
after return Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
|
pure virtual |
Print to an output stream a description of this iteration quantity.
The purpose if this method is allow the client get information as to what the type of the iteration quantity really is for debugging and informational purposes. This should just include information on types and nothing else.
The concrete type of this
can be printed using typeName(*this)
.
Implemented in IterationPack::IterQuantityAccessContiguous< T_info >.
void IterationPack::IterQuantity::assert_has_storage_k | ( | int | offset | ) | const |
Assert has_storage_k(offset) == true
(throw NoStorageAvailable
).
Definition at line 52 of file IterationPack_IterQuantity.cpp.
void IterationPack::IterQuantity::assert_updated_k | ( | int | offset | ) | const |
Assert updated_k(offset) == true (throw QuanityNotSet).
Definition at line 60 of file IterationPack_IterQuantity.cpp.