/* 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.
 *
 */


#ifndef _NMM_DEFINITION_HPP
#define _NMM_DEFINITION_HPP

#include "nmm/nmm_prefix.hpp"

#include <list>
#include <map>
#include <vector>

#include "nmm/nmm_inttypes.hpp"

#include "nmm/utils/NamedObject.hpp"

namespace NMM {

/** Several "typedef's" and "define's".
 *
 *   This file includes encloses several 
 *   "typedef's" and "define's",         
 *   needed by the classes for the format
 *   negotiotion.                        
 */

  /////////////////////////////////////
  // forward declaration
  /////////////////////////////////////

  class Format;
  class Parameter;
  class Node;
  class Vertex;
//  class GraphDevice;
//  class GraphManager;
  class Edge;
  class R_FLOAT;
  class R_INT;
  class Negotiation_Objects;
//  class Node_Connector;
//  class ConnectionObject;
//  class ConnectionObjectMulti;
//  class UserNode;
//  class PathObject;
  class Property;
  class ParameterException;
//  class PathFinder;
//  class DependentTreeResult;
//  class DependentTreeResultItem;

  /////////////////////////////////////
  // structs
  /////////////////////////////////////

  struct NegotiationResult
  {
    Format *SourceFormat;
    Format *SinkFormat;
    float  cost;
  };

  struct Parameter_Value_Assignment
  {
    Parameter * param;
    void *      value;
    bool        move;
  };

  /**
     The struct assignment stores the connection between
     a Format of a Graphdevice and a Vertex in the
     Graph.
  **/
  struct assignment 
  {
    Format * aFormat;
    Vertex * aVertex;
  };

  /**
     Stores the value of a wildcard parameter.
   **/
  union data_value
  {
    int32_t m_int;
    float   m_float;
    char *  m_string;
  };


  struct Format_Pair
  {
    Format * input_format;
    Format * output_format;
  };

  ///////////////////////////////////////
  // typedef
  // for lists:
  ///////////////////////////////////////
  
//  typedef list<ConnectionObjectMulti *> connection_object_multi_list;
//  typedef list<ConnectionObject *> connection_object_list;
//  typedef list<Node_Connector> node_connector_list;
  typedef list<NegotiationResult> negotiationresult_list;
//  typedef list<Negotiation_Result *> negotiation_result_list;
  typedef list<Format *> format_list;
  typedef list<const Format *> const_format_list;
  typedef list<Parameter *> parameter_list;
  typedef list<Node *> node_list;
  typedef list<Vertex *> vertex_list;
  typedef list<Edge *> edge_list;
  typedef list<Parameter_Value_Assignment *> parameter_value_list;
  typedef list<string> string_list;
  typedef list<assignment>::const_iterator FVA_Iterator;
  typedef list<Negotiation_Objects *> negotiation_objects_list;
  typedef vector<Edge> vector_edge_list;
//  typedef list<UserNode *> user_node_list;
//  typedef list<PathObject *> path_object_list;
//  typedef list<DependentTreeResult *> dependent_tree_result_list;

  // parameter-key list
  typedef list<int32_t> int32_t_list;
  typedef list<float> float_list;
  typedef list<R_INT *> r_int32_t_list;
  typedef list<R_FLOAT *> r_float_list;
  
  
  ///////////////////////////////////////
  // typedef
  // for iterators
  //////////////////////////////////////

//  typedef list<ConnectionObjectMulti *>::iterator connection_object_multi_iterator;
//  typedef list<ConnectionObject *>::iterator connection_object_iterator;
  typedef list<Negotiation_Objects *>::iterator negotiation_objects_iterator;
//  typedef list<GraphDevice *>::iterator graphdevice_iterator;
//  typedef list<Node_Connector>::iterator node_connector_iterator;
  typedef list<NegotiationResult>::iterator negotiationresult_iterator;
//  typedef list<Negotiation_Result *>::iterator negotiation_result_iterator;
  typedef list<Node *>::iterator node_iterator;
  typedef list<Format *>::iterator format_iterator;
  typedef list<Parameter *>::const_iterator parameter_iterator;
  typedef list<Edge *>::iterator edge_iterator;
  typedef map<int32_t,float>::iterator INT32_Iterator;
  typedef map<float, float>::iterator FLOAT_Iterator;
  typedef map<string, float>::iterator STRING_Iterator;
//  typedef list<GraphDevice *>::iterator GraphDevice_Iterator;
  typedef list<Vertex *>::iterator Vertex_Iterator;
  typedef list<R_FLOAT *>::iterator R_FLOAT_Iterator;
  typedef list<R_INT *>::iterator R_INT_Iterator;
  typedef list<Parameter_Value_Assignment *>::iterator parameter_value_iterator;
  typedef list<string>::iterator string_iterator;
  typedef vector<Edge>::iterator Edge_Iterator;
  typedef list<format_list::iterator> format_list_iterator_list;

  ////////////////////////////////////////
  // defines
  ////////////////////////////////////////
  
  //! The standard value for the weighting factor **/
  #define  DEFAULT_WEIGHT 1.0

  //! The maximum cost of the a vertex during the dijkstra algorithm.
  //   static const int NMM_INFINITY = 100;
  static const int NMM_INFINITY = INT_MAX;

  //! The maximal computer-utilization. Change this at will, if it's clear what are COSTS !
  static const float COMPUTER_UTILIZATION = 100;
}

#include "nmm/nmm_suffix.hpp"

#endif
