neic-glass3  1.4.6
Public Member Functions | List of all members
glass3::parse::JSONParser Class Reference

json parser class More...

#include <jsonparser.h>

Inheritance diagram for glass3::parse::JSONParser:
Inheritance graph
Collaboration diagram for glass3::parse::JSONParser:
Collaboration graph

Public Member Functions

 JSONParser (const std::string &defaultAgencyID, const std::string &defaultAuthor)
 jsonparser constructor More...
 
 ~JSONParser ()
 jsonparser destructor More...
 
std::shared_ptr< json::Object > parse (const std::string &input) override
 json parsing function More...
 
- Public Member Functions inherited from glass3::parse::Parser
 Parser ()
 
 Parser (const std::string &defaultAgencyID, const std::string &defaultAuthor)
 parser constructor More...
 
virtual ~Parser ()
 parser destructor More...
 
- Public Member Functions inherited from glass3::util::BaseClass
 BaseClass ()
 BaseClass constructor. More...
 
virtual ~BaseClass ()
 BaseClass destructor. More...
 
virtual bool setup (std::shared_ptr< const json::Object > config)
 BaseClass configuration function. More...
 
virtual void clear ()
 BaseClass clear function. More...
 
const std::shared_ptr< const json::Object > getConfig ()
 
bool getSetup ()
 Retrieves the class member boolean flag indicating whether the class has been setup, set to true if setup was successful. More...
 
const std::string & getDefaultAgencyId ()
 Function to retrieve the name of the default agency id. More...
 
void setDefaultAgencyId (const std::string &id)
 Function to set the name of the default agency id. More...
 
const std::string & getDefaultAuthor ()
 Function to retrieve the name of the default author. More...
 
void setDefaultAuthor (const std::string &author)
 Function to set the name of the default author. More...
 

Additional Inherited Members

- Protected Attributes inherited from glass3::util::BaseClass
std::shared_ptr< const json::Object > m_Config
 A shared pointer to the json::Object that holds the configuration. More...
 
std::atomic< bool > m_bIsSetup
 the boolean flag indicating whether the class has been setup, set to true if setup was successful. More...
 
std::string m_DefaultAgencyID
 A std::string containing the default agency id to use in parsing if one is not provided. More...
 
std::string m_DefaultAuthor
 A std::string containing the default author to use in parsing if one is not provided. More...
 

Detailed Description

json parser class

The glass json parser class is a class encapsulating the logic for converting a string to a json message and validating the results.

JSON messages don't have a single format. Any of the valid detection-formats messages are accepted by this parser.

This class depends on the earthquake detection formats library to parse and format message strings.

This class uses the external SuperEasyJSON library to return parsed messages

This class inherits from the glass3::parse::Parser class

Constructor & Destructor Documentation

glass3::parse::JSONParser::JSONParser ( const std::string &  defaultAgencyID,
const std::string &  defaultAuthor 
)

jsonparser constructor

The constructor for the jsonparser class. Initializes members to provided values.

Parameters
defaultAgencyID- A std::string containing the agency id to use if one is not provided.
defaultAuthor- A std::string containing the author to use if one is not provided.
glass3::parse::JSONParser::~JSONParser ( )

jsonparser destructor

The jsonparser for the gpickparser class.

Member Function Documentation

std::shared_ptr< json::Object > glass3::parse::JSONParser::parse ( const std::string &  input)
overridevirtual

json parsing function

An overridden function (from Parser) used to parse a given json formatted string (from a file, broker, or other source) into a SuperEasyJSON object (the common data interchange object) which is returned as a shared_ptr for use in other neic-glass3 functions and classes (such as glasscore).

Parameters
input- The json formatted std::string to parse
Returns
Returns a shared_ptr to the json::Object containing the data.

Implements glass3::parse::Parser.


The documentation for this class was generated from the following files: