Skip to content

Commit

Permalink
add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
dan-du-car committed Jul 19, 2023
1 parent 4e6aa43 commit a1faf70
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,9 @@ namespace tmx::utils::sim
populateSimExternalObjectHeader(root["header"], simExternalObj);
}

/**
* Populate simulation external object presence vector
*/
if (root.isMember("presence_vector") && root["presence_vector"].isUInt())
{
auto presence_vetor = presenceVectorIntToEnum(root["presence_vector"].asUInt());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,69 @@ namespace tmx::utils::sim
class SimulationExternalObjectConverter
{
private:
/***
* @brief Populate simulation external object metadata with metadata information from JSON string.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param metadataValue Json value that contains the metadata information.
*/
static void populateSimExternalObjectMetadata(const Json::Value &metadataValue, tmx::messages::simulation::ExternalObject &simExternalObj);
/***
* @brief Populate simulation external object header with header information from JSON string.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param headerValue Json value that contains the header information.
*/
static void populateSimExternalObjectHeader(const Json::Value &headerValue, tmx::messages::simulation::ExternalObject &simExternalObj);
/***
* @brief Populate simulation external object pose with pose information from JSON string.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param poseValue Json value that contains the pose information.
*/
static void populateSimExternalObjectPose(const Json::Value &poseValue, tmx::messages::simulation::ExternalObject &simExternalObj);
/***
* @brief Populate simulation external object velocity with velocity information from JSON string.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param velocityValue Json value that contains the velocity information.
*/
static void populateSimExternalObjectVelocity(const Json::Value &velocityValue, tmx::messages::simulation::ExternalObject &simExternalObj);
/***
* @brief Populate simulation external object size with size information from JSON string.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param sizeValue Json value that contains the size information.
*/
static void populateSimExternalObjectSize(const Json::Value &sizeValue, tmx::messages::simulation::ExternalObject &simExternalObj);
/***
* @brief Populate simulation external object covariance array with covariance array information from JSON string.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param covarianceArrayValue Json value that contains the covariance array information.
*/
static void populateSimCovarianceArray(const Json::Value &covarianceArrayValue, std::vector<tmx::messages::simulation::Covariance> &covarianceV);
/***
* @brief Convert the object type in string format to enum.
* @param object_type_str object type in string format.
* @return tmx::messages::simulation::OBJECT_TYPES V2xHub customized simulation object types.
*/
static tmx::messages::simulation::OBJECT_TYPES objectTypeStringToEnum(const std::string& object_type_str);
/***
* @brief Convert the presence vector integer to enum.
* @param presence_vector presence vetor integer.
* @return tmx::messages::simulation::PRESENCE_VECTOR_TYPES V2xHub customized simulation presence vetor types.
*/
static tmx::messages::simulation::PRESENCE_VECTOR_TYPES presenceVectorIntToEnum(uint16_t presence_vector);

public:
SimulationExternalObjectConverter() = default;
~SimulationExternalObjectConverter() = default;
SimulationExternalObjectConverter() = delete;
~SimulationExternalObjectConverter() = delete;
/***
* @brief Convert simulation external object into JSON string defined by MOSAIC and CARMAStreets integration.
* @param ExternalObject V2xHub customized simulation external object.
* @return EcternalObject string in JSON format defined by MOSAIC and CARMAStreets integration.
*/
static std::string simExternalObjToJsonStr(tmx::messages::simulation::ExternalObject &simExternalObj);
/***
* @brief Populate simulation external object with JSON string defined by MOSAIC and CARMAStreets integration.
* @param ExternalObject V2xHub customized simulation external object to populate.
* @param jsonStr EcternalObject in JSON format defined by MOSAIC and CARMAStreets integration.
*/
static void jsonToSimExternalObj(const std::string &jsonStr, tmx::messages::simulation::ExternalObject &simExternalObj);
};
}

0 comments on commit a1faf70

Please sign in to comment.