/*********************************************************************/
/* */
/* AgentService Framework */
/* www.agentservice.it */
/* */
/* Copyright (C) 2007 l.i.d.o. - DIST, University of Genoa, Italy */
/* GNU Lesser General Public License */
/* */
/* This library is free software; you can redistribute it and/or */
/* modify it under the terms of the GNU Lesser General Public */
/* License as published by the Free Software Foundation, */
/* version 2.1 of the License. */
/* */
/* This library 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 */
/* Lesser General Public License for more details. */
/* */
/* You should have received a copy of the GNU Lesser General Public */
/* License along with this library; if not, write to the */
/* Free Software Foundation, Inc., 59 Temple Place - Suite 330, */
/* Boston, MA 02111-1307, USA. */
/* */
/*********************************************************************/
using System;
using System.Runtime.Serialization;
namespace AgentService.Agent.Behaviour
{
///
/// Class BehaviourPersistent. Defines the persistent version of the behaviour.
///
[Serializable()]
public class BehaviourPersistent
{
///
/// Name of the behaviour instance
///
public string Name;
///
/// State of the behaviour
///
public BehaviourState State;
///
/// Name of the instance type
///
public string BehaviourTypeName;
///
/// Name of the knowledge instances used by the behaviour instance
///
public String[] KnowledgeNames;
///
/// Constructs a BehaviourPersistent object.
///
/// name of the behaviour instance
/// actual state of the behaviour instance
/// type of the behaviour instance
/// array of names of the knowlege instances used by the behaviour instance
public BehaviourPersistent(string name, BehaviourState state, string behaviourType, params string[] knowledgeNames)
{
this.Name = name;
this.State = state;
this.BehaviourTypeName = behaviourType;
this.KnowledgeNames = knowledgeNames;
}
///
/// Deserialization constructor
///
/// SerializationInfo to populate with data
/// contextual information about the source or destination of the serialization
public BehaviourPersistent(SerializationInfo info, StreamingContext context)
{
this.Name = info.GetValue("Name",typeof(string)) as string;
this.State = (BehaviourState) info.GetValue("State",typeof(BehaviourState));
this.KnowledgeNames = info.GetValue("KnowledgeNames",typeof(string[])) as string[];
}
///
/// Populates a specified SerializationInfo with the data needed to serialize the current ObjRef instance
///
/// SerializationInfo to populate with data
/// contextual information about the source or destination of the serialization
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("Name",this.Name);
info.AddValue("State",this.State);
info.AddValue("KnowledgeNames",this.KnowledgeNames);
}
}
}