/usr/include/sigc++-1.2/sigc++/node.h is in libsigc++-1.2-dev 1.2.7-2.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 | // -*- c++ -*-
/*
Copyright 2000, Karl Einar Nelson
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; either
version 2 of the License, or (at your option) any later version.
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
*/
#ifndef SIGC_NODE
#define SIGC_NODE
#include <sigcconfig.h>
#ifdef SIGC_CXX_NAMESPACES
namespace SigC
{
#endif
// common portion of all sigc internals.
// must be dynamic.
class LIBSIGC_API NodeBase
{
public:
// Type used to build lists.
struct Link { NodeBase *next_,*prev_; };
/* link & notify must be implemented if the object can be a dependency */
// Link to list holding dependency
virtual Link* link(); // nothrow
// Called by object on which node depends
// TODO: Please document what from_child exactly means, i.e. in
// which context is what called a "child", and why there has to be
// a distinction between "child" and non-"child". Examples would
// be really nice.
virtual void notify(bool from_child); // nothrow
// referencing
void reference() // nothrow
{ count_+=1; }
void unreference() // nothrow
{ if (!--count_) delete this; }
NodeBase();
virtual ~NodeBase();
// these should be atomics
int count_; // reference count
// flags are shared with derived classes to save space
unsigned int notified_ :1; // we have been notified, no need to remove self
// connection flags
unsigned int blocked_ :1; // skip callling.
unsigned int defered_ :1; // skip callling.
private:
NodeBase(const NodeBase&); // not copiable
NodeBase& operator=(const NodeBase&); // not copiable
};
class LIBSIGC_API Node
{
public:
operator bool() const { return valid(); }
bool empty() const { return !valid(); }
void clear() const;
Node() : node_(0) {}
SIGC_CXX_EXPLICIT_COPY Node(const Node& s)
{ s.valid(); assign(s.node_); }
SIGC_CXX_EXPLICIT Node(NodeBase* s) { assign(s); }
~Node() { clear(); }
void* impl() const { return node_; }
protected:
// this verifies the node is valid else severs the link
bool valid() const;
void assign(NodeBase* node);
Node& operator =(const Node&);
mutable NodeBase* node_;
};
#ifdef SIGC_CXX_NAMESPACES
}
#endif
#endif // SIGC_NODE
|