1 // 2 // aegis - project change supervisor 3 // Copyright (C) 2004-2006, 2008, 2012 Peter Miller 4 // 5 // This program is free software; you can redistribute it and/or modify 6 // it under the terms of the GNU General Public License as published 7 // by the Free Software Foundation; either version 3 of the License, or 8 // (at your option) any later version. 9 // 10 // This program is distributed in the hope that it will be useful, 11 // but WITHOUT ANY WARRANTY; without even the implied warranty of 12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 13 // General Public License for more details. 14 // 15 // You should have received a copy of the GNU General Public License 16 // along with this program. If not, see <http://www.gnu.org/licenses/>. 17 // 18 19 #include <common/ac/assert.h> 20 21 #include <aecvsserver/file_info.h> 22 #include <aecvsserver/module.h> 23 #include <aecvsserver/server.h> 24 25 ~module_ty()26module_ty::~module_ty() 27 { 28 assert(reference_count == 1); 29 reference_count = -666; 30 if (canonical_name) 31 { 32 str_free(canonical_name); 33 canonical_name = 0; 34 } 35 } 36 37 module_ty()38module_ty::module_ty() : 39 reference_count(1), 40 canonical_name(0) 41 { 42 } 43 44 45 void reference_count_down()46module_ty::reference_count_down() 47 { 48 assert(reference_count >= 1); 49 if (reference_count <= 1) 50 delete this; 51 reference_count--; 52 } 53 54 55 void reference_count_up()56module_ty::reference_count_up() 57 { 58 assert(reference_count >= 1); 59 reference_count++; 60 } 61 62 63 string_ty * name()64module_ty::name() 65 { 66 if (!canonical_name) 67 { 68 canonical_name = calculate_canonical_name(); 69 } 70 return canonical_name; 71 } 72 73 74 void checkout(server_ty * sp)75module_ty::checkout(server_ty *sp) 76 { 77 options opt; 78 opt.d = 1; 79 opt.C = 1; 80 if (update(sp, name(), name(), opt)) 81 server_ok(sp); 82 } 83 84 85 bool is_bogus() const86module_ty::is_bogus() 87 const 88 { 89 return false; 90 } 91 92 93 // vim: set ts=8 sw=4 et : 94