Main Page | Class Hierarchy | Class List | File List | Class Members

Value.h

00001 // Value.h -- The interface to the super class of all CSP values.
00002 
00003 /*
00004  * Copyright (C) 1997, 1998 Tudor Hulubei <tudor@hulubei.net>.
00005  *
00006  * This library is free software; you can redistribute it and/or modify
00007  * it under the terms of the GNU Lesser General Public License as
00008  * published by the Free Software Foundation; either version 2, or (at
00009  * your option) any later version.
00010  *
00011  * This library is distributed in the hope that it will be useful,
00012  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00013  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00014  * GNU Lesser General Public License for more details.
00015  *
00016  * You should have received a copy of the GNU Lesser General Public
00017  * License along with this library; if not, write to the Free Software
00018  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA,
00019  * 02111-1307, USA.
00020  */
00021 
00022 /*
00023  * NOTE: This is an interal header file.
00024  * You should not attempt to use it directly.
00025  */
00026 
00027 // $Id: Value_8h-source.html,v 1.1 2005/05/25 12:37:18 tudor Exp $
00028 
00029 #ifndef _CSP_KERNEL_Value_H
00030 #define _CSP_KERNEL_Value_H
00031 
00032 
00033 CSP_NAMESPACE_BEGIN(csp);
00034 
00035 
00039 class CSP_API Value
00040 {
00041   public:
00043     Value() : m_id(NoId), m_failures(0) {}
00044 
00046     virtual ~Value() {}
00047 
00049     Value(const Value&) { m_id = NoId; m_failures = 0; }
00050 
00052     Value& operator=(const Value&) { m_id = NoId; return *this; }
00053 
00055     void setId(id_t id) { m_id = id; }
00056 
00058     id_t id() const { return m_id; }
00059 
00062     ulonglong failures() const { return m_failures; }
00063 
00065     void incrementFailures() { m_failures++; }
00066 
00068     virtual wostream& print(wostream& wos) const { return wos; }
00069 
00071     friend CSP_API wostream& operator<<(wostream& wos, const Value& value)
00072     {
00073         return value.print(wos);
00074     }
00075 
00076   private:
00077     // The value's id.
00078     id_t m_id;
00079 
00080     // The number of consistency failures this value was involved in.
00081     // See the Filter object.
00082     ulonglong m_failures;
00083 };
00084 
00085 
00086 CSP_NAMESPACE_END(csp);
00087 
00088 
00089 #endif // _CSP_KERNEL_Value_H
00090 
00091 // Local Variables:
00092 // mode: C++
00093 // End:

Generated on Wed May 25 12:21:15 2005 for csp.kdevelop by  doxygen 1.3.9.1