/* Network-Integrated Multimedia Middleware (NMM)
 * http://www.motama.com/nmm.html
 *  
 * Copyright (C) 2006-2007
 * Motama GmbH, Saarbruecken, Germany
 * http://www.motama.com
 *  
 * This file is part of NMM. 
 * 
 * NMM is free software; you can redistribute it and/or modify it    
 * under the terms of the GNU General Public License as published by 
 * the Free Software Foundation; only version 2 of the License.      
 * 
 * NMM is distributed in the hope that it will be useful, but WITHOUT 
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY 
 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public 
 * License for more details.  
 * 
 * You should have received a copy of the GNU General Public License 
 * along with NMM; if not, write to the Free Software Foundation,    
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
 *
 */
 
#include <string>
#include <list>
#include "nmm/multimedia/INode.hpp"

#include "nmm/nmm_strstream.hpp"

#include "visibility.hpp"

#ifndef _NMM_PARSERSTRUCTS_HPP_
#define _NMM_PARSERSTRUCTS_HPP_

#include "nmm/nmm_prefix.hpp"


namespace NMM {
  class NodeDescription;
}

/** a NCElement consist in an event (as string) and a state */
struct NCElement {
  string              event_key;
  vector<string>      argument_list;
  NMM::INode::State   state;
};

/** Store information from graph description files conerning one node. 
 */
class DLLEXPORT NodeConfiguration {
public:  
  /** Constructor */
  NodeConfiguration( ) : __nd(0) {}

  /** Reset the internal attributes */
  void clear()          
                                     { __event_list.clear(); __nd = 0; }
  /** Add a new event that should be send to the node. 
  * @param nc node configuration element
  */
  void addNCElement(const NCElement& nc)                     { __event_list.push_back(nc); }

  /** Set the NodeDescription that should receive the events.
   *  @param nd pointer to NodeDescription to set
   */
  void setNodeDescription(NMM::NodeDescription* nd)          { __nd = nd; }
  
  /** Return the list with all events and their corresponding states.
   *
   * @return list with all events and their corresponding states   
   */  
  const list<NCElement>& getEventList()                const { return __event_list; }

  /** Return the list with all events and their corresponding states.
   *
   * @return list with all events and their corresponding states   
   */
  list<NCElement>& getEventList()                      { return __event_list; }

  /** Return the NodeDescription that should receive the events.
   *
   * @return Pointer to member variable of NodeDescriptin that should receive the events
   */
  const NMM::NodeDescription* getNodeDescription()     const { return __nd; }

  /** Return the NodeDescription that should receive the events.
   *
   * @return  Pointer to member variable of NodeDescriptin that should receive the events
   */
  NMM::NodeDescription* getNodeDescription()           { return __nd; }
  
private:
  list<NCElement>        __event_list;            ///< stores the events (and corresponding states) that should be send to a node
  NMM::NodeDescription*  __nd;                    ///< stores the NodeDescription to identify the node
};

#include "nmm/nmm_suffix.hpp"

#endif
