Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-common
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Core Modules
dune-common
Commits
b65c6adb
Commit
b65c6adb
authored
14 years ago
by
Oliver Sander
Browse files
Options
Downloads
Patches
Plain Diff
remove deprecated file smartpointer.hh
[[Imported from SVN: r6004]]
parent
98b0f3d9
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
dune/common/Makefile.am
+1
-1
1 addition, 1 deletion
dune/common/Makefile.am
dune/common/smartpointer.hh
+0
-180
0 additions, 180 deletions
dune/common/smartpointer.hh
with
1 addition
and
181 deletions
dune/common/Makefile.am
+
1
−
1
View file @
b65c6adb
...
...
@@ -14,7 +14,7 @@ commoninclude_HEADERS = alignment.hh array.hh \
fvector.hh ftraits.hh genericiterator.hh
\
helpertemplates.hh iteratorfacades.hh
\
misc.hh poolallocator.hh finitestack.hh
\
sllist.hh shared_ptr.hh
smartpointer.hh
stdstreams.hh timer.hh tuples.hh
\
sllist.hh shared_ptr.hh stdstreams.hh timer.hh tuples.hh
\
typetraits.hh precision.hh bigunsignedint.hh
\
gcd.hh lcm.hh configparser.hh propertymap.hh
\
collectivecommunication.hh mpihelper.hh singleton.hh
\
...
...
This diff is collapsed.
Click to expand it.
dune/common/smartpointer.hh
deleted
100644 → 0
+
0
−
180
View file @
98b0f3d9
// -*- tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*-
// vi: set et ts=4 sw=2 sts=2:
// $Id$
#ifndef DUNE_SMARTPOINTER_HH
#define DUNE_SMARTPOINTER_HH
#include
<cassert>
#warning This file is deprecated. Please use shared_ptr.hh instead!
/**
* @file
* @brief This file implements the class SmartPointer which is a reference counting
* pointer.
* @author Markus Blatt
*/
namespace
Dune
{
/** @addtogroup Common
*
* @{
*/
/**
* @brief A reference counting smart pointer.
*
* It is designed such that it is usable within a std::vector.
* The contained object is destroyed only if there are no more
* references to it.
*/
template
<
class
T
>
class
SmartPointer
{
public:
/**
* @brief The data type we are a pointer for.
*
* This has to have a parameterless constructor.
*/
typedef
T
MemberType
;
/**
* @brief Constructs a new smart pointer and allocates the referenced Object.
*/
inline
SmartPointer
();
/**
* @brief Constructs a new smart pointer from a preallocated Object.
*
* note: the object must be allocated on the heap and after handing the pointer to
* SmartPointer the ownership of the pointer is also handed to the SmartPointer.
*/
inline
SmartPointer
(
T
*
pointer
);
/**
* @brief Copy constructor.
* @param pointer The object to copy.
*/
inline
SmartPointer
(
const
SmartPointer
<
T
>&
pointer
);
/**
* @brief Destructor.
*/
inline
~
SmartPointer
();
/** \brief Assignment operator */
inline
SmartPointer
&
operator
=
(
const
SmartPointer
<
T
>&
pointer
);
/** \brief Dereference as object */
inline
MemberType
&
operator
*
();
/** \brief Dereference as pointer */
inline
MemberType
*
operator
->
();
/** \brief Dereference as const object */
inline
const
MemberType
&
operator
*
()
const
;
/** \brief Dereference as const pointer */
inline
const
MemberType
*
operator
->
()
const
;
/**
* @brief Deallocates the references object if no other
* pointers reference it.
*/
inline
void
deallocate
();
int
count
()
const
;
private:
/** @brief The object we reference. */
class
PointerRep
{
friend
class
SmartPointer
<
MemberType
>
;
/** @brief The number of references. */
int
count_
;
/** @brief The representative. */
MemberType
*
rep_
;
/** @brief Default Constructor. */
PointerRep
()
:
count_
(
0
),
rep_
(
0
)
{}
/** @brief Constructor from existing Pointer. */
PointerRep
(
MemberType
*
p
)
:
count_
(
1
),
rep_
(
p
)
{}
/** @brief Destructor, deletes MemberType* rep_. */
~
PointerRep
()
{
delete
rep_
;
}
}
*
rep_
;
};
template
<
class
T
>
inline
SmartPointer
<
T
>::
SmartPointer
(
T
*
p
)
{
rep_
=
new
PointerRep
(
p
);
}
template
<
class
T
>
inline
SmartPointer
<
T
>::
SmartPointer
()
{
rep_
=
new
PointerRep
;
}
template
<
class
T
>
inline
SmartPointer
<
T
>::
SmartPointer
(
const
SmartPointer
<
T
>&
other
)
:
rep_
(
other
.
rep_
)
{
++
(
rep_
->
count_
);
}
template
<
class
T
>
inline
SmartPointer
<
T
>&
SmartPointer
<
T
>::
operator
=
(
const
SmartPointer
<
T
>&
other
)
{
(
other
.
rep_
->
count_
)
++
;
if
(
rep_
!=
0
&&
--
(
rep_
->
count_
)
<=
0
)
delete
rep_
;
rep_
=
other
.
rep_
;
return
*
this
;
}
template
<
class
T
>
inline
SmartPointer
<
T
>::~
SmartPointer
()
{
if
(
rep_
!=
0
&&
--
(
rep_
->
count_
)
==
0
)
{
delete
rep_
;
rep_
=
0
;
}
}
template
<
class
T
>
inline
T
&
SmartPointer
<
T
>::
operator
*
()
{
return
*
(
rep_
->
rep_
);
}
template
<
class
T
>
inline
T
*
SmartPointer
<
T
>::
operator
->
()
{
return
rep_
->
rep_
;
}
template
<
class
T
>
inline
const
T
&
SmartPointer
<
T
>::
operator
*
()
const
{
return
*
(
rep_
->
rep_
);
}
template
<
class
T
>
inline
const
T
*
SmartPointer
<
T
>::
operator
->
()
const
{
return
rep_
->
rep_
;
}
template
<
class
T
>
inline
int
SmartPointer
<
T
>::
count
()
const
{
return
rep_
->
count_
;
}
template
<
class
T
>
inline
void
SmartPointer
<
T
>::
deallocate
()
{
assert
(
rep_
!=
0
&&
rep_
->
count_
==
1
);
delete
rep_
;
rep_
=
0
;
}
/** @} */
}
#endif
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment