/*********************************************************************/
/* */
/* 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.Knowledge
{
///
/// Class KnowledgePersistent. Defines the persistent version of a knowledge object.
///
[Serializable()]
public class KnowledgePersistent : ISerializable
{
///
/// Knowledge string identifier (name)
///
public string Name;
///
/// Type name of the persisted knowledge object
///
public string TypeName;
///
/// List of items
///
public System.Collections.Hashtable Items;
///
/// Persistence mode
///
public PersistenceMode Mode;
///
/// Default Constructor
///
public KnowledgePersistent()
{
this.Items = new System.Collections.Hashtable();
}
///
/// Constructs a KnowledgePersistent object with the given name
///
/// The name of the Knowledge to be persistent
public KnowledgePersistent(string name)
{
this.Name = name;
this.Items = new System.Collections.Hashtable();
}
///
/// Constructs a KnowledgePersistent object with the given name
///
/// name of the knowledge instance whose data will be persisted
/// knowledge instance items
public KnowledgePersistent(string name, System.Collections.Hashtable items)
{
this.Name = name;
this.Items = items;
}
///
/// Constructs a KnowledgePersistent object from a streaming context
///
/// SerializationInfo to populate with data
/// contextual information about the source or destination of the serialization
public KnowledgePersistent(SerializationInfo info, StreamingContext context)
{
this.Name = info.GetValue("name", typeof(string)) as string;
this.TypeName = info.GetValue("typeName", typeof(string)) as string;
this.Items = info.GetValue("items", typeof(System.Collections.Hashtable)) as System.Collections.Hashtable;
this.Mode = (PersistenceMode)info.GetValue("Mode", typeof(PersistenceMode));
}
///
/// 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("typeName", this.TypeName);
info.AddValue("items", this.Items);
info.AddValue("Mode", this.Mode);
}
}
}