// Copyright (C) 2016 CNRS
// Authors:  Anna Seppala
//
// This file is part of the hpp-affordance-corbaserver.
//
// This software is provided "as is" without warranty of any kind,
// either expressed or implied, including but not limited to the
// implied warranties of fitness for a particular purpose.
//
// See the COPYING file for more information.

#ifndef HPP_AFFORDANCE_CORBA_SERVER_IDL
# define HPP_AFFORDANCE_CORBA_SERVER_IDL
# include <hpp/common.idl>
module hpp
{
  typedef sequence<double> doubleSeq;
	typedef sequence<doubleSeq> doubleSeqSeq;
	typedef sequence<doubleSeqSeq> doubleSeqSeqSeq;
	typedef sequence<doubleSeqSeqSeq> doubleSeqSeqSeqSeq;
  module corbaserver {
    module affordance {

      /// Creation of a device.
      interface Afford {

				/// reset the current configuration of the given affordance type
				/// requirement to default values
				void resetAffordanceConfig() raises (Error);

				/// changes the default configuration of the given affordance type requirement
				///
				///	The configuration vector has size 3 and comprises the error margin,
				/// the angle margin for neighbouring triangles and the minimum area,
				/// in that order.
				///
				/// \param affType affordance type for which the change is made
                                /// \param conf configuration vector of size 3. The parameters are (in order):
                                /// +the margin needed for the evaluation of the requirement function,
                                /// +the margin between two triangles tested for a single
                                ///  affordance surface. If the angle between two triangles is greater
                                ///  than the provided margin, the triangles cannot be part of the same
                                ///  affordance surface.
                                /// + the minimum area needed for the formation of an affordance object
				void setAffordanceConfig (in string affType, in doubleSeq conf)
					raises (Error);

				/// returns the configuration of the given affordance type requirement
				///
                                ///	\param affType affordance type for which the configuration is requested.
                                ///	\return configuration for which the values mean (in order):
                                /// +the margin needed for the evaluation of the requirement function,
                                /// +the margin between two triangles tested for a single
                                ///  affordance surface. If the angle between two triangles is greater
                                ///  than the provided margin, the triangles cannot be part of the same
                                ///  affordance surface.
                                /// + the minimum area needed for the formation of an affordance object
				doubleSeq getAffordanceConfig (in string affType) raises (Error);

				/// changes the error margin used to evaluate the affordance requirement
				/// of a given affordance type
				///
				/// \param affType affordance type for which the change is made
				/// \param margin new value for the error margin
				void setMargin (in string affType, in double margin) raises (Error);

				/// changes the angle margin used to evaluate whether neighbouring
				/// triangles form part of the potential affordance as the current
				/// triangle.
				///
				/// \param affType affordance type for which the change is made
				/// \param nbTriMargin new value for the neighbouring triangle margin
				void setNeighbouringTriangleMargin (in string affType,
					in double nbTriMargin) raises (Error);

                                /// changes the minimum area used to evaluate the affordance requirement
				/// of a given affordance type
				/// \param affType affordance type for which the change is made
				/// \param nimArea new value for the minimum accepted area
					void setMinimumArea (in string affType, in double minArea)
					raises (Error);

        /// checks whether obstacle model is of a type compatible with
        /// affordance analysis. The only accepted model type is
        /// coal::BVH_MODEL_TRIANGLES.
        /// \param obstacleName Name of the collisionObstacle to be checked.
        boolean checkModel (in string obstacleName) raises (Error);

				/// creates collisionObjects for each found affordance of
				/// given object. Affordances are added to a container in problemSolver
				///
				/// \param obstacleName Name of the collisionObstacle to be analysed
        void analyseObject (in string obstacleName,in doubleSeq reduceSizes) raises (Error);

				/// creates collisionObjects for each affordance found in
				/// the scene (goes through all obstacles). Affordances are added to
				/// a container in problemSolver.
                                void analyseAll (in doubleSeq reduceSizes) raises (Error);

				/// deletes all affordance objects of given obstacle.
				///
				/// \param obstacleName name of obstacle, the affordances of which will
				/// be deleted
				void deleteAffordances (in string obstacleName) raises (Error);

				/// deletes affordance objects of given affordance type
				/// for a given obstacle
				/// \param affordance Type of affordance to be deleted
				/// \param obstacleName name of obstacle, the affordances of which will
				/// be deleted.
				void deleteAffordancesByType (in string affordance,
					in string obstacleName) raises (Error);

				/// returns vertice points for each triangle in each affordance object
				/// of specified aff type
				/// \param affordance Affordance type for which triangle points
				///	are searched.
				doubleSeqSeqSeqSeq getAffordancePoints (in string affordance)
					raises (Error);

				/// returns a list of reference obstacles corresponding to the
				/// affordance type. The size of the return variable is equal
				/// to the number of affordances of given type.
				///
				/// \param affordance Affordance type for which reference obstacles
				/// are searched.
				Names_t getAffRefObstacles (in string affordance)
					raises (Error);

				/// Get list of affordance types used in affordance analysis.
				Names_t getAffordanceTypes () raises (Error);

        /// Get list of affordance configuration types used in affordance analysis.
				Names_t getAffordanceConfigTypes () raises (Error);

			}; // interface Afford
    }; // module affordance
  }; // module corbaserver
}; // module hpp
#endif // HPP_AFFORDANCE_CORBA_SERVER_IDL
