Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
K
kicad-source-mirror
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
kicad-source-mirror
Commits
4539c8c4
Commit
4539c8c4
authored
Nov 24, 2008
by
dickelbeck
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
better type safety on list Insert(), Remove(), Append()
parent
b113d17e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
56 additions
and
15 deletions
+56
-15
dlist.h
include/dlist.h
+56
-15
No files found.
include/dlist.h
View file @
4539c8c4
...
@@ -57,21 +57,6 @@ protected:
...
@@ -57,21 +57,6 @@ protected:
~
DHEAD
();
~
DHEAD
();
public
:
/**
* Function DestructAll
* deletes all items on the list and leaves the list empty.
*/
void
DestructAll
();
/**
* Function SetOwnership
* controls whether the list owns the objects and is responsible for
* deleteing their memory at time of this object's destruction.
*/
void
SetOwnership
(
bool
Iown
)
{
meOwner
=
Iown
;
}
/**
/**
* Function Append
* Function Append
* adds \a aNewElement to the end of the list.
* adds \a aNewElement to the end of the list.
...
@@ -100,6 +85,23 @@ public:
...
@@ -100,6 +85,23 @@ public:
*/
*/
void
Remove
(
EDA_BaseStruct
*
aElement
);
void
Remove
(
EDA_BaseStruct
*
aElement
);
public
:
/**
* Function DestructAll
* deletes all items on the list and leaves the list empty.
*/
void
DestructAll
();
/**
* Function SetOwnership
* controls whether the list owns the objects and is responsible for
* deleteing their memory at time of this object's destruction.
*/
void
SetOwnership
(
bool
Iown
)
{
meOwner
=
Iown
;
}
/**
/**
* Function GetCount
* Function GetCount
* returns the number of elements in the list.
* returns the number of elements in the list.
...
@@ -137,6 +139,45 @@ public:
...
@@ -137,6 +139,45 @@ public:
* returns the last T* in the list, or NULL if the list is empty.
* returns the last T* in the list, or NULL if the list is empty.
*/
*/
T
*
GetLast
()
const
{
return
(
T
*
)
last
;
}
T
*
GetLast
()
const
{
return
(
T
*
)
last
;
}
/**
* Function Append
* adds \a aNewElement to the end of the list.
*/
void
Append
(
T
*
aNewElement
)
{
DHEAD
::
Append
(
aNewElement
);
}
/**
* Function Insert
* puts aNewElement just in front of aElementAfterMe in the list sequence.
* If aElementAfterMe is NULL, then simply Append()
*/
void
Insert
(
T
*
aNewElement
,
T
*
aElementAfterMe
)
{
DHEAD
::
Insert
(
aNewElement
,
aElementAfterMe
);
}
/**
* Function Insert
* puts aNewElement in front of list sequence.
*/
void
Insert
(
T
*
aNewElement
)
{
DHEAD
::
Insert
(
aNewElement
);
}
/**
* Function Remove
* removes \a aElement from the list, but does not delete it.
*/
void
Remove
(
T
*
aElement
)
{
DHEAD
::
Remove
(
aElement
);
}
};
};
#endif // DLIST_H_
#endif // DLIST_H_
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment