Sorry I attached the wrong file.

Juan Hernando escribió:
Dear Equalizer developers,

Recently I've started porting and MPK based application to Equalizer. In order to initialize the configuration, the old application enabled the user to provide a configuration at runtime. In Equalizer that's trickier to do because I need to start the eqServer from my application. So instead of doing that I'd like to use a local server inside the application node process and use Server::useConfig to give the configuration as a string. I know the function is undocumented and may disappear but in my case, it's useful, unless there is an easier way of starting the server with a user given configuration. I've written a small test, which now is working. However it was crashing in the beginning and after some debugging I've come across something that, to me, seems to be a bug in Server::useConfig. Analyzing the code I've found that there is a difference between chooseConfig and useConfig in the sequence of operations performed in the server, while the first one calls Server::addConfig for the default config at some moment, the latter doesn't.
After the following change in Server::_cmdUseConfig:
EQINFO << "Using config: " << endl << Global::instance() << config << endl;
    config->setApplicationNetNode( node );
    +addConfig( config );
    mapConfig( config );
the test application works.

Is that a bug or am I doing something wrong in my test program (find the source attached)?

Thanks and best regards,
Juan Hernando


------------------------------------------------------------------------

_______________________________________________
eq-dev mailing list
[email protected]
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

#include <eq/eq.h>

/**
   The application derived factory for custom objects
*/
class NodeFactory : public eq::NodeFactory
{
public:
    virtual eq::Config *createConfig(eq::base::RefPtr<eq::Server> parent);
};

/**
   The application specific Config object
*/
class Config : public eq::Config
{
public:
    Config(eq::ServerPtr parent) :
        eq::Config(parent)
    {}

    virtual bool init()
    {
        return eq::Config::init(0);
    }
};

eq::Config *NodeFactory::createConfig(eq::base::RefPtr<eq::Server> parent)
{
    return new Config(parent); 
}

int main( const int argc, char** argv )
{
    /* Equalizer initialization. */
    NodeFactory nodeFactory;
    if (!eq::init(argc, argv, &nodeFactory)) {
        std::cerr << "Equalizer init failed" << std::endl;
        return -1;
    }
 
    /* Initialization of local client node. */
    eq::ClientPtr client = new eq::Client();
    if (!client->initLocal(argc, argv)) {
        std::cerr << "Can't init client" << std::endl;
        return -1;
    }   

    /* Connecting to the server. */
    eq::ServerPtr server = new eq::Server();
    if (!client->connectServer(server)) {
        std::cerr << "Can't open server" << std::endl;
        return -1;
    }
 
    /* Getting a configuration */
//    Config *config = static_cast<Config*>
//        (server->chooseConfig(eq::ConfigParams()));
    Config *config = static_cast<Config*>
        (server->useConfig(eq::ConfigParams(),
                           "config {"
                           " appNode {" 
                           "  pipe {" 
                           "   window {"
                           "    viewport [0 0 1 1]"
                           "    channel { name \"channel\" }"
                           "   }"
                           "  }"
                           " }"
                           " compound {"
                           "  channel \"channel\" wall {"
                           "   bottom_left [ -.8 -.5 -1 ]"
                           "   bottom_right [  .8 -.5 -1 ]"
                           "   top_left [ -.8  .5 -1 ]"
                           "  }"
                           " }"
                           "}"));

    if (config == 0) {
        std::cerr << "No matching config on server" << std::endl;
        _exit(0);
        client->disconnectServer(server);
        return -1;
    }
 
    config->init();
    config->exit();

    server->releaseConfig(config);

    /* Server disconnection */
    client->disconnectServer(server);
    server = 0;

    /* Local client finalization */
    client->exitLocal();
    client = 0;

    /* Equalizer finalization */
    eq::exit();

    std::cout << "Exiting" << std::endl;
    return 0;
}


_______________________________________________
eq-dev mailing list
[email protected]
http://www.equalizergraphics.com/cgi-bin/mailman/listinfo/eq-dev
http://www.equalizergraphics.com

Reply via email to