Pothos
0.4.1-gb758ed46
The Pothos dataflow programming software suite
|
#include <Object.hpp>
Public Member Functions | |
Object (void) | |
Object (const Object &obj) | |
Object (Object &obj) | |
Object (Object &&obj) | |
Object (const Object &&obj) | |
template<typename ValueType > | |
Object (ValueType &&value) | |
virtual | ~Object (void) |
Object & | operator= (const Object &rhs) |
Object & | operator= (Object &&rhs) |
operator bool (void) const | |
bool | unique (void) const |
const std::type_info & | type (void) const |
template<typename ValueType > | |
const ValueType & | extract (void) const |
template<typename ValueType > | |
ValueType | convert (void) const |
Object | convert (const std::type_info &type) const |
bool | canConvert (const std::type_info &type) const |
std::ostream & | serialize (std::ostream &os) const |
std::istream & | deserialize (std::istream &is) |
int | compareTo (const Object &other) const |
size_t | hashCode (void) const |
std::string | toString (void) const |
std::string | getTypeString (void) const |
bool | equals (const Object &obj) const |
bool | operator< (const Object &obj) const |
bool | operator> (const Object &obj) const |
Static Public Member Functions | |
template<typename ValueType > | |
static Object | make (ValueType &&value) |
static bool | canConvert (const std::type_info &srcType, const std::type_info &dstType) |
Public Attributes | |
Detail::ObjectContainer * | _impl |
Private implementation details. More... | |
Object is a general type capable of storing arbitrary data types. When an Object instance is copied, the internal data is not copied. The internal data is only deleted when all Object copies are gone.
Pothos::Object::Object | ( | void | ) |
Create a null Object.
Pothos::Object::Object | ( | const Object & | obj | ) |
Pothos::Object::Object | ( | Object & | obj | ) |
Pothos::Object::Object | ( | Object && | obj | ) |
Pothos::Object::Object | ( | const Object && | obj | ) |
|
explicit |
Create a new Object from an an arbitrary value.
value | the data to store internally |
|
virtual |
bool Pothos::Object::canConvert | ( | const std::type_info & | type | ) | const |
Is the conversion of this Object to specified type possible?
type | the desired typeid in question |
|
static |
Is the conversion from source type to destination type possible?
srcType | the type of the conversion input |
dstType | the type of the conversion output |
int Pothos::Object::compareTo | ( | const Object & | other | ) | const |
Returns a negative integer, zero, or a positive integer as this object is less than, equal to, or greater than the specified object.
ObjectCompareError | when the compare isnt possible |
other | the other proxy object to compare against |
ValueType Pothos::Object::convert | ( | void | ) | const |
Convert performs a safe conversion that respects the value when an exact type conversion is not required or wanted. For example, the object may contain an int, we want a long.
ObjectConvertError | if object cannot be safe casted |
Object Pothos::Object::convert | ( | const std::type_info & | type | ) | const |
std::istream& Pothos::Object::deserialize | ( | std::istream & | is | ) |
Deserialize the stream into the contents of this Object. Only make this call on a null object.
ObjectSerializeError | if the type is not registered |
is | the input stream holding serialized data |
bool Pothos::Object::equals | ( | const Object & | obj | ) | const |
Value-based equality operator. When supported, the implementation uses the compareTo() method. Otherwise, the hash codes are compared for checking equality.
const ValueType & Pothos::Object::extract | ( | void | ) | const |
Cast the internal data to an arbitrary type. The requested cast type must exactly match the type().
ObjectConvertError | if object type != ValueType |
std::string Pothos::Object::getTypeString | ( | void | ) | const |
Get a printable string representing the type held by this Object.
size_t Pothos::Object::hashCode | ( | void | ) | const |
Get a hash code for the contained object. The hash code should be identical for equivalent objects.
|
static |
Create an object where type can be explicitly specified. The make method allows users to pass an explicit type, which is not possible using the templated constructor. Also, the make method can create an Object containing another object; which is not possible with constructors because the copy constructor.
value | a value of arbitrary type to put in an Object |
|
explicit |
Does the object hold a value?
bool Pothos::Object::operator< | ( | const Object & | obj | ) | const |
Less than comparable operator. When supported, the implementation uses the compareTo() method. Otherwise, the hash codes are compared for sorting purposes.
bool Pothos::Object::operator> | ( | const Object & | obj | ) | const |
Greater than comparable operator. When supported, the implementation uses the compareTo() method. Otherwise, the hash codes are compared for sorting purposes.
std::ostream& Pothos::Object::serialize | ( | std::ostream & | os | ) | const |
Serialize the contents of the object into a stream.
ObjectSerializeError | if the type is not registered |
os | the output stream for the serialized data |
std::string Pothos::Object::toString | ( | void | ) | const |
Get a printable string representation for this Object. The string formatting depends upon the contained value.
const std::type_info& Pothos::Object::type | ( | void | ) | const |
Get the type of the internal data. The call returns typeid(NullObject) if the Object is null.
bool Pothos::Object::unique | ( | void | ) | const |
Is the Object unique?
Detail::ObjectContainer* Pothos::Object::_impl |
Private implementation details.