Kaydet (Commit) f1277f25 authored tarafından Ivo Hinkelmann's avatar Ivo Hinkelmann

INTEGRATION: CWS configrefactor01 (1.5.14); FILE MERGED

2007/01/11 10:35:32 mmeeks 1.5.14.2: Submitted by: mmeeks

Large scale re-factoring, remove fine-grained locking in favor of a simple,
single global lock (still in progress).
Identify and fix various hot-spots.
Remove otherwise empty / non-compiled files.
Kill UpdateAccessor
2007/01/08 20:48:57 mmeeks 1.5.14.1: Issue number:
Submitted by: mmeeks
Substantial configmgr re-factoring #1 ...
	+ remove endless typedef chains
	+ remove custom allocator & associated complexity
	+ remove Pointer, and 'Address' classes
üst 30d3fafd
...@@ -4,9 +4,9 @@ ...@@ -4,9 +4,9 @@
* *
* $RCSfile: valuenodeaccess.hxx,v $ * $RCSfile: valuenodeaccess.hxx,v $
* *
* $Revision: 1.5 $ * $Revision: 1.6 $
* *
* last change: $Author: kz $ $Date: 2006-11-06 14:49:26 $ * last change: $Author: ihi $ $Date: 2007-11-23 14:27:51 $
* *
* The Contents of this file are made available subject to * The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1. * the terms of GNU Lesser General Public License Version 2.1.
...@@ -47,48 +47,24 @@ namespace configmgr ...@@ -47,48 +47,24 @@ namespace configmgr
{ {
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
class ValueNodeAccess class ValueNodeAccess
{ {
public: public:
typedef NodeAccess::Name Name; ValueNodeAccess(const sharable::ValueNode *_pNodeRef)
typedef NodeAccess::Attributes Attributes; : m_pData(((sharable::Node *)_pNodeRef)->valueData()) {}
typedef ValueNodeAddress NodeAddressType;
typedef ValueNodeAddress::AddressType AddressType;
typedef ValueNodeAddress::DataType const DataType;
typedef DataType * NodePointerType;
ValueNodeAccess(Accessor const& _aAccessor, NodeAddressType const& _aNodeRef)
: m_aAccessor(_aAccessor)
, m_pData(_aNodeRef.m_pData)
{}
ValueNodeAccess(Accessor const& _aAccessor, NodePointerType _pNode)
: m_aAccessor(_aAccessor)
, m_pData(check(_aAccessor,_pNode))
{}
explicit explicit
ValueNodeAccess(NodeAccess const & _aNode) ValueNodeAccess(NodeAccess const & _aNode)
: m_aAccessor(_aNode.accessor()) : m_pData(check(_aNode)) {}
, m_pData(check(_aNode))
{
}
explicit
ValueNodeAccess(NodeAccessRef const & _aNode)
: m_aAccessor(_aNode.accessor())
, m_pData(check(_aNode))
{
}
static bool isInstance(NodeAccessRef const & _aNode) static bool isInstance(NodeAccess const & _aNode)
{ {
return check(_aNode) != NULL; return check(_aNode) != NULL;
} }
bool isValid() const { return m_pData != NULL; } bool isValid() const { return m_pData != NULL; }
Name getName() const; configuration::Name getName() const;
Attributes getAttributes() const; node::Attributes getAttributes() const;
bool isEmpty() const { return data().isEmpty(); } bool isEmpty() const { return data().isEmpty(); }
...@@ -103,34 +79,33 @@ namespace configmgr ...@@ -103,34 +79,33 @@ namespace configmgr
uno::Any getUserValue() const; uno::Any getUserValue() const;
uno::Any getDefaultValue() const; uno::Any getDefaultValue() const;
static void setValue(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode, uno::Any const& _aValue); static void setValue(ValueNodeAddress _aValueNode, uno::Any const& _aValue);
static void setToDefault(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode); static void setToDefault(ValueNodeAddress _aValueNode);
static void changeDefault(memory::UpdateAccessor & _aUpdater, NodeAddressType _aValueNode, uno::Any const& _aValue); static void changeDefault(ValueNodeAddress _aValueNode, uno::Any const& _aValue);
NodeAddressType address() const { return NodeAddressType(m_pData); }
Accessor const& accessor() const { return m_aAccessor; }
DataType& data() const { return *static_cast<NodePointerType>(m_aAccessor.validate(m_pData)); } sharable::ValueNode& data() const { return *m_pData; }
operator ValueNodeAddress () const { return (ValueNodeAddress)m_pData; }
operator NodeAccessRef() const { return NodeAccessRef(&m_aAccessor,NodeAddress(m_pData)); } operator NodeAccess() const { return NodeAccess(NodeAddress(m_pData)); }
bool operator == (const NodeAddress &rAddr) const { return NodeAddress(m_pData) == rAddr; }
bool operator == (const ValueNodeAddress &rAddr) const { return m_pData == rAddr; }
private: private:
static AddressType check(Accessor const& _acc, NodePointerType _p) { return _acc.address(_p); } static ValueNodeAddress check(sharable::Node *pNode)
static AddressType check(NodeAccessRef const& _aNodeData); { return pNode ? const_cast<ValueNodeAddress>(pNode->valueData()) : NULL; }
static ValueNodeAddress check(NodeAccess const&aRef)
{ return check(static_cast<sharable::Node *>(aRef)); }
Accessor m_aAccessor; ValueNodeAddress m_pData;
AddressType m_pData;
}; };
ValueNodeAddress toValueNodeAddress(memory::Accessor const & _aAccess, NodeAddress const & _aNodeAddr);
ValueNodeAddress toValueNodeAddress(memory::UpdateAccessor & _aAccess, NodeAddress const & _aNodeAddr);
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
inline inline
NodeAccess::Name ValueNodeAccess::getName() const configuration::Name ValueNodeAccess::getName() const
{ return NodeAccess::wrapName( data().info.getName() ); } { return NodeAccess::wrapName( data().info.getName() ); }
inline inline
NodeAccess::Attributes ValueNodeAccess::getAttributes() const node::Attributes ValueNodeAccess::getAttributes() const
{ return sharable::node(data()).getAttributes(); } { return sharable::node(data()).getAttributes(); }
inline inline
...@@ -143,15 +118,15 @@ namespace configmgr ...@@ -143,15 +118,15 @@ namespace configmgr
inline inline
uno::Any ValueNodeAccess::getValue() const uno::Any ValueNodeAccess::getValue() const
{ return data().getValue(m_aAccessor); } { return data().getValue(); }
inline inline
uno::Any ValueNodeAccess::getUserValue() const uno::Any ValueNodeAccess::getUserValue() const
{ return data().getUserValue(m_aAccessor); } { return data().getUserValue(); }
inline inline
uno::Any ValueNodeAccess::getDefaultValue() const uno::Any ValueNodeAccess::getDefaultValue() const
{ return data().getDefaultValue(m_aAccessor); } { return data().getDefaultValue(); }
// ------------------------------------------------------------------------- // -------------------------------------------------------------------------
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment