コード例 #1
0
MapServiceConnector::ptr_t MapServiceConnectorFactory::Create( const std::string& config_pathname,
                                                               Status&            status )
{
    // Log Entry
    BOOST_LOG_TRIVIAL(trace) << "MapServiceConnector::" << __func__ << ", Start of Method";
    
    // Load the Configuration
    Configuration options = ConfigParser(config_pathname).Load_Configuration(status);
    
    // Check if Initialized
    if( Is_Initialized() == false ){
        status = Initialize( options );
        if( status.Get_Code() != StatusCode::SUCCESS ){
            return nullptr;
        }
    }

    // Check the status
    if( status.Get_Code() != StatusCode::SUCCESS ){
        return nullptr;
    }

    // Load and return the new connector
    MapServiceConnector::ptr_t connector = std::make_shared<MapServiceConnector>( options );
    
    // Log Entry
    BOOST_LOG_TRIVIAL(trace) << "MapServiceConnector::" << __func__ << ", End of Method";

    // Return Success
    status = Status( StatusCode::SUCCESS );
    return connector;
}
コード例 #2
0
Base_Connector::ptr_t Connection_Generator_Factory::Create( const Configuration&  configuration,
                                                            Status&               status )
{
    // Log Entry
    std::string m_class_name = "Connection_Generator_Factory";
    BOOST_LOG_TRIVIAL(trace) << CLASS_LOG << ", Start of Method.";
    
    // Get the name
    std::string name = configuration.Get_Value("connector","",status );

    // Get instance
    gen_ptr instance = Get_Instance(status);
    if( status.Get_Code() != StatusCode::SUCCESS ){
        return nullptr;
    }

    // Check if name exists
    if( instance->m_generator_map.find(name) == 
        instance->m_generator_map.end() )
    {
        status = Status( StatusCode::NO_CONNECTOR_FOUND,
                         "No Connection Generator Found.");
        return nullptr;
    }

    // Return the result
    return instance->m_generator_map.find(name)->second->Create( configuration, status );

}