#include <ExpectedType.h>
Protected Member Functions | |
bool | equals (const ExpectedType *other) const |
Friends | |
struct | ExpectedType |
An object bearing the information that the expected type of some operation is T. If you have a complex function which will return an object of a certain type depending on runtime circumstances, you can write another function that will quickly inspect the parameters to provide information on the type returned by the complex function. Usage example:
class Foo : public BaseClass { ... }; class Bar : public BaseClass { ... }; class ComplexOp { ... // The complex operation takes a long time and returns either a // Foo or a Bar depending on the parameter BaseClass::Ptr complexOperation(int parameter); // Informs the user quickly what type will be provided. ExpectedType::Ptr complexOperationResult(int parameter) { if (parameter > 0) return ExpectedType::Ptr(new ExpectedTypeIs<Foo>); else return ExpectedType::Ptr(new ExpectedTypeIs<Bar>); } };
Definition at line 112 of file ExpectedType.h.
bool icl_core::ExpectedTypeIs< T >::equals | ( | const ExpectedType * | other | ) | const [inline, protected, virtual] |
Implements icl_core::ExpectedType.
Definition at line 115 of file ExpectedType.h.
friend struct ExpectedType [friend] |
Definition at line 119 of file ExpectedType.h.