00001 #ifndef CATALOGABLE_IMPLEMENTATION_FILE 00002 #define CATALOGABLE_IMPLEMENTATION_FILE 00003 00004 /*****************************************************************************\ 00005 * * 00006 * Name : catalogable * 00007 * Author : Chris Koeritz * 00008 * * 00009 ******************************************************************************* 00010 * Copyright (c) 1997-$now By Author. This program is free software; you can * 00011 * redistribute it and/or modify it under the terms of the GNU General Public * 00012 * License as published by the Free Software Foundation; either version 2 of * 00013 * the License or (at your option) any later version. This is online at: * 00014 * http://www.fsf.org/copyleft/gpl.html * 00015 * Please send any updates to: fred@gruntose.com * 00016 \*****************************************************************************/ 00017 00018 #include "catalogable.h" 00019 00020 #include <basis/function.h> 00021 #include <data_struct/unique_id.h> 00022 00023 namespace nodes { 00024 00025 catalogable::catalogable() : _uid(new unique_int(0)) {} 00026 00027 catalogable::catalogable(const unique_int &id) 00028 : _uid(new unique_int(id)) 00029 {} 00030 00031 catalogable::catalogable(const catalogable &to_copy) 00032 : object_base(), mutex(), _uid(new unique_int(*to_copy._uid)) {} 00033 00034 catalogable::~catalogable() { WHACK(_uid); } 00035 00036 catalogable &catalogable::operator =(const catalogable &to_copy) 00037 { 00038 if (this == &to_copy) return *this; 00039 *_uid = *to_copy._uid; 00040 return *this; 00041 } 00042 00043 unique_int catalogable::id() const { return *_uid; } 00044 00045 void catalogable::assign_unique_id(const unique_int &new_id) 00046 { *_uid = new_id; } 00047 00048 } // namespace. 00049 00050 #endif //CATALOGABLE_IMPLEMENTATION_FILE 00051
1.5.1