Equalizer  1.2.1
findPipe.h
00001 
00002 /* Copyright (c) 2010, Stefan Eilemann <eile@eyescale.ch> 
00003  *
00004  * Redistribution and use in source and binary forms, with or without
00005  * modification, are permitted provided that the following conditions are met:
00006  *
00007  * Redistributions of source code must retain the above copyright notice, this
00008  * list of conditions and the following disclaimer. Redistributions in binary
00009  * form must reproduce the above copyright notice, this list of conditions and
00010  * the following disclaimer in the documentation and/or other materials provided
00011  * with the distribution. Neither the name of Eyescale Software GmbH nor the
00012  * names of its contributors may be used to endorse or promote products derived
00013  * from this software without specific prior written permission.
00014  *
00015  * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
00016  * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
00017  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
00018  * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
00019  * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
00020  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
00021  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
00022  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
00023  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
00024  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
00025  * POSSIBILITY OF SUCH DAMAGE.
00026  */
00027 
00028 #ifndef EQ_ADMIN_FIND_PIPE_H
00029 #define EQ_ADMIN_FIND_PIPE_H
00030 
00031 #include <eq/admin/base.h>
00032 
00033 namespace eqAdmin
00034 {
00035 
00036 inline eq::admin::Pipe* findPipe( eq::admin::ServerPtr server )
00037 {
00038     // Find first pipe...
00039     const eq::admin::Configs& configs = server->getConfigs();
00040     if( configs.empty( ))
00041     {
00042         std::cout << "No configs on server, exiting" << std::endl;
00043         return 0;
00044     }
00045 
00046     eq::admin::Config* config = configs.front();
00047     const eq::admin::Nodes& nodes = config->getNodes();
00048     if( nodes.empty( ))
00049     {
00050         std::cout << "No nodes in config, exiting" << std::endl;
00051         return 0;
00052     }
00053  
00054     const eq::admin::Node* node = nodes.front();
00055     const eq::admin::Pipes& pipes = node->getPipes();
00056     if( pipes.empty( ))
00057     {
00058         std::cout << "No pipes in node, exiting" << std::endl;
00059         return 0;
00060     }
00061 
00062     return pipes.front();
00063 }
00064 
00065 }
00066 #endif // EQ_ADMIN_FIND_PIPE_H
Generated on Fri Jun 8 2012 15:44:30 for Equalizer 1.2.1 by  doxygen 1.8.0