Serialize JSON

Algorithm Implementations

activity_type

class activity_type : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const kwiver::vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual kwiver::vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

activity

class activity : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const kwiver::vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual kwiver::vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

bounding_box

class bounding_box : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &elements) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

detected_object_set

class detected_object_set : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

detected_object_type

class detected_object_type : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

detected_object

class detected_object : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &elements) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

image

class image : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

metadata_map_io

class metadata_map_io : public kwiver::vital::algo::metadata_map_io

An implementation class for reading and writing metadata maps.

This class is a concrete implementation for reading and writing video metadata.

Public Functions

virtual kwiver::vital::metadata_map_sptr load_(std::istream &fin, std::string const &filename) const override

Load in the data from a file.

Throws:

file_not_read_exception – Thrown if the file can’t be opened for reading, likely due to permissions or not being present.

Parameters:

filename – The path to the file to load.

Returns:

An image container referring to the loaded image.

virtual void save_(std::ostream &fout, kwiver::vital::metadata_map_sptr data, std::string const &filename) const override

Save metadata to a file.

Throws:

file_write_exception – Thrown if the file can’t be opened, likely due to permissions or a missing containing directory.

Parameters:
  • filename – The path to the file to save.

  • data – The metadata map for a video.

class priv

metadata

class metadata : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(vital::any const &elements) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(std::string const &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

object_track_set

class object_track_set : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

object_track_state

class object_track_state : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

string

class string : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

timestamp

class timestamp : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &elements) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

track_set

class track_set : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

track_state

class track_state : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.

track

class track : public kwiver::vital::algo::data_serializer

Public Functions

virtual std::shared_ptr<std::string> serialize(const vital::any &element) override

Serialize the item into a byte string.

This method serializes the supplied data item(s) and returns a byte string.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

The type of the data represented by the datum must match the type expected by the serializer implementation or an exception will be thrown.

Parameters:

elements – Data items to be serialized.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Byte string of serialized data item.

virtual vital::any deserialize(const std::string &message) override

Deserialize byte string into data type.

Deserialize the supplied string of bytes into new data item(s). This method must handle an input byte string created by the serialize() method and convert it to the concrete type(s). The actual type used for the conversion is based on the concrete implementation of this algorithm. If the input byte string does not represent the expected data type, then an exception will be thrown.

All implementations must define the set of expected element names. An exception is thrown if a names is supplied and is not known to the implementation. An implementation can elect to accept an input map that does not contain all supported element names.

If the implementation only supports a single data element, then the name associated with that element will be “datum”.

Parameters:

message – Serialized data item that is to be processed.

Throws:
  • kwiver::vital::bad_any_cast

  • kwiver::vital::serialization – - for unexpected element name

Returns:

Concrete data type, represented as an any, created from the input.