Protected Member Functions | Friends
icl_core::ExpectedTypeIs< T > Struct Template Reference

#include <ExpectedType.h>

Inheritance diagram for icl_core::ExpectedTypeIs< T >:
Inheritance graph
[legend]

List of all members.

Protected Member Functions

bool equals (const ExpectedType *other) const

Friends

struct ExpectedType

Detailed Description

template<typename T>
struct icl_core::ExpectedTypeIs< T >

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>);
    }
  };
See also:
ExpectedType for how to use the expected type result.

Definition at line 112 of file ExpectedType.h.


Member Function Documentation

template<typename T >
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.


Friends And Related Function Documentation

template<typename T >
friend struct ExpectedType [friend]

Definition at line 119 of file ExpectedType.h.


The documentation for this struct was generated from the following file:


fzi_icl_core
Author(s):
autogenerated on Thu Jun 6 2019 20:22:26