OMKInteractorOutput.cpp

Go to the documentation of this file.
00001 
00002 /************************************************************************/
00003 /* This file is part of openMask(c) INRIA, CNRS, Universite de Rennes 1 */
00004 /* 1993-2002, thereinafter the Software                                 */
00005 /*                                                                      */
00006 /* The Software has been developped within the Siames Project.          */
00007 /* INRIA, the University of Rennes 1 and CNRS jointly hold intellectual */
00008 /* property rights                                                      */
00009 /*                                                                      */
00010 /* The Software has been registered with the Agence pour la Protection  */
00011 /* des Programmes (APP) under registration number                       */
00012 /* IDDN.FR.001.510008.00.S.P.2001.000.41200                             */
00013 /*                                                                      */
00014 /* This file may be distributed under the terms of the Q Public License */
00015 /* version 1.0 as defined by Trolltech AS of Norway and appearing in    */
00016 /* the file LICENSE.QPL included in the packaging of this file.         */
00017 /*                                                                      */
00018 /* Licensees holding valid specific licenses issued by INRIA, CNRS or   */
00019 /* Universite Rennes 1 for the software may use this file in            */
00020 /* acordance with that specific license                                 */
00021 /************************************************************************/
00022                 
00023 #include "OMKInteractorOutput.h"
00024 #include "OMKExtensibleSimulatedObject.h"
00025 #include "OMKInteractorExtension.h"
00026 #include "OMKInteractiveEventId.h"
00027 #include "OMKIAttribute.h"
00028 #include "OMKParametersAccessor.inl"
00029 
00030 #include "OMKTransformType.h"
00031 using namespace OMK ;
00032 using namespace OMK::Iii ;
00033 using namespace OMK::Type ;
00034 
00035 //-----------------------------------------------------------------
00036 InteractorOutput::InteractorOutput( const Name& id, InteractorExtension *interactor, 
00037                                     const Name& category, const Name& type )
00038 : _id( id ), 
00039   _category( category ), 
00040   _type( type ),
00041   _interactor( interactor )
00042 { 
00043 }
00044 //-----------------------------------------------------------------
00045 void InteractorOutput::setAccessGroup( const AccessGroupLevel& accessGroup ) 
00046 {
00047   if( accessGroup.empty() )
00048   {
00049     _accessGroup.clear() ;
00050     _accessGroup[ "*" ] = -1 ;
00051   }
00052   else
00053   {
00054     _accessGroup = accessGroup ;
00055   }
00056 }
00057 //-----------------------------------------------------------------
00058 bool InteractorOutput::create( const Name& id,
00059                                InteractorExtension *extension, 
00060                                const ConfigurationParameterDescriptor * node ) 
00061 {
00062   // try to loads parameters
00063   Name category( "undefined" ) ;
00064   bool exclusive = false ;
00065   Name attributeId( id ) ;
00066   AccessGroupLevel accessGroup ;
00067   bool ok = ParametersAccessor::get( node, "Category", category ) ;
00068   ParametersAccessor::get( node, "AttributeId", attributeId ) ;
00069   ParametersAccessor::get( node, "AccessSetting", accessGroup ) ;
00070   if( ok ) create( id, attributeId, extension, category, accessGroup, true ) ;
00071   return ok ; 
00072 }
00073 //-----------------------------------------------------------------
00074 void InteractorOutput::create( const Name& id,
00075                                const Name& atttributeId,
00076                                InteractorExtension *interactor, 
00077                                const Name& category,
00078                                const AccessGroupLevel& accessGroup,
00079                                bool setByEvent ) 
00080 {
00081   ExtensibleSimulatedObject* owner = interactor->getInteractor() ;
00082   // try to find the associated output 
00083   IAttribute* attribute = owner->getAttribute( id ) ;
00084   if( attribute )
00085   {
00086     // Creates the interactor output
00087     InteractorOutput *interactorOutput = InteractorOutputFactory::getInstance().create( owner->getAttribute( id )->getTypes() )
00088       ( id, atttributeId, interactor, category, setByEvent ) ;
00089     // Adds it to the listener which will store and manage it
00090     interactor->addInteractorOutput( interactorOutput ) ;
00091     // Set the access group settings
00092     interactorOutput->setAccessGroup( accessGroup ) ;
00093 
00094     OMTRACEID( OMK_DEBUG_III, "Information for " << OMK::debugMsg( interactor, owner ) << std::endl
00095         << ">>> Create the interactor output for \"" << id << "\" category \"" << interactorOutput->category() << "\"" ) ; 
00096   }
00097   else
00098   {
00099     OMTRACEID( OMK_DEBUG_III, ":-( Error for " << OMK::debugMsg( interactor, owner ) << std::endl
00100              << ">>> Unable to create the interactor output for \"" << id << "\" because this attribute doesn't exist !" ) ; 
00101   }
00102 }

logo OpenMask

Documentation generated on Mon Jun 9 11:45:56 2008

Generated with doxygen by Dimitri van Heesch ,   1997-2007