# ObjectMapper.hpp
This File On Github
Ask A Question
API: latest
module: oatpp-mongo
#include "oatpp-mongo/bson/mapping/ObjectMapper.hpp"
# ObjectMapper
BSON ObjectMapper. Serialized/Deserializes oatpp DTO objects to/from BSON. See Data Transfer Object(DTO) component.
Extends oatpp::base::Countable, oatpp::data::mapping::ObjectMapper.
namespace oatpp { namespace mongo { namespace bson { namespace mapping {
class ObjectMapper : public oatpp::base::Countable, public oatpp::data::mapping::ObjectMapper {}
}}}}
# Methods
Return Type | Name | Summary |
---|---|---|
[none] | ObjectMapper | Multiple implementations:
|
std::shared_ptr<ObjectMapper> | createShared | Multiple implementations:
|
void | write | Implementation of oatpp::data::mapping::ObjectMapper::write(). |
oatpp::Void | read | Implementation of oatpp::data::mapping::ObjectMapper::read(). |
std::shared_ptr<Serializer> | getSerializer | Get serializer. |
std::shared_ptr<Deserializer> | getDeserializer | Get deserializer. |
# ObjectMapper::ObjectMapper
- Constructor.
- @param serializerConfig - oatpp::parser::bson::mapping::Serializer::Config.
- @param deserializerConfig - oatpp::parser::bson::mapping::Deserializer::Config.
ObjectMapper(const std::shared_ptr<Serializer::Config>& serializerConfig, const std::shared_ptr<Deserializer::Config>& deserializerConfig)
- Constructor.
- @param serializer
- @param deserializer
ObjectMapper(const std::shared_ptr<Serializer>& serializer = std::make_shared<Serializer>(), const std::shared_ptr<Deserializer>& deserializer = std::make_shared<Deserializer>())
# ObjectMapper::createShared
- Create shared ObjectMapper.
- @param serializerConfig - oatpp::parser::bson::mapping::Serializer::Config.
- @param deserializerConfig - oatpp::parser::bson::mapping::Deserializer::Config.
- @return -
std::shared_ptr
to ObjectMapper.
static std::shared_ptr<ObjectMapper> createShared(const std::shared_ptr<Serializer::Config>& serializerConfig, const std::shared_ptr<Deserializer::Config>& deserializerConfig)
- Create shared ObjectMapper.
- @param serializer
- @param deserializer
- @return
static std::shared_ptr<ObjectMapper> createShared(const std::shared_ptr<Serializer>& serializer = std::make_shared<Serializer>(), const std::shared_ptr<Deserializer>& deserializer = std::make_shared<Deserializer>())
# ObjectMapper::write
Implementation of oatpp::data::mapping::ObjectMapper::write().
- @param stream - stream to write serializerd data to oatpp::data::stream::ConsistentOutputStream.
- @param variant - object to serialize oatpp::Void.
void write(data::stream::ConsistentOutputStream* stream, const oatpp::Void& variant) const override
# ObjectMapper::read
Implementation of oatpp::data::mapping::ObjectMapper::read().
- @param caret - oatpp::parser::Caret.
- @param type - type of resultant object oatpp::data::mapping::type::Type.
- @return - oatpp::Void holding resultant object.
oatpp::Void read(oatpp::parser::Caret& caret, const oatpp::data::mapping::type::Type* const type) const override
# ObjectMapper::getSerializer
Get serializer.
- @return
std::shared_ptr<Serializer> getSerializer()
# ObjectMapper::getDeserializer
Get deserializer.
- @return
std::shared_ptr<Deserializer> getDeserializer()