3131#include " Common/Overridable.h"
3232
3333/*
34- An OVERRIDE is a replacement for a pointer of its contained type, ie, rather than containing
35- a LocomotorTemplate*, you would contain an OVERRIDE <LocomotorTemplate>.
34+ An OverridePtr is a replacement for a pointer of its contained type, ie, rather than containing
35+ a LocomotorTemplate*, you would contain an OverridePtr <LocomotorTemplate>.
3636
37- OVERRIDE pretends in all ways (dereference via *, -> and casting to type*) to be a type*, so
37+ OverridePtr pretends in all ways (dereference via *, -> and casting to type*) to be a type*, so
3838 there should be very little code that needs to be rewritten to work with these.
3939
4040 In order to make something overridable, these are the steps:
4141 1) Make the desired class derive from Overridable.
42- 2) Make the container class contain an instance of OVERRIDE <Type>
42+ 2) Make the container class contain an instance of OverridePtr <Type>
4343 3) Make the newOverride function (wherever an override is new'd) request the overridables lastOverride,
4444 to ensure that no leaks are created.
4545
4646 See LocomotorTemplate for an example.
4747*/
4848
49- template <class T > class OVERRIDE
49+ template <class T > class OverridePtr
5050{
5151 public:
52- // Provide useful constructores to go from a T* to an OVERRIDE <T>
53- OVERRIDE (const T *overridable = nullptr );
52+ // Provide useful constructores to go from a T* to an OverridePtr <T>
53+ OverridePtr (const T *overridable = nullptr );
5454 // Copy constructor
55- OVERRIDE ( OVERRIDE <T> &overridable);
56- // Operator= for copying from another OVERRIDE and T*
57- __inline OVERRIDE &operator =( const OVERRIDE <T>& override );
58- __inline OVERRIDE &operator =( const T* overridable );
55+ OverridePtr (OverridePtr <T> &overridable);
56+ // Operator= for copying from another OverridePtr and T*
57+ __inline OverridePtr &operator =( const OverridePtr <T>& other );
58+ __inline OverridePtr &operator =( const T* overridable );
5959
6060 // these are the methods which we can use to access data in a pointer. (Dereference*, ->, and cast
6161 // to T*). They are all overloaded to recurse to the lowest override and use that.
@@ -67,44 +67,44 @@ template <class T> class OVERRIDE
6767 __inline const T *getNonOverloadedPointer ( void ) const ;
6868
6969 private:
70- // Because OVERRIDE is meant to live on the object and not in the store, it currently contains
70+ // Because OverridePtr is meant to live on the object and not in the store, it currently contains
7171 // a constant pointer. We could change this if it seems weird.
7272 const T *m_overridable;
7373};
7474
7575// -------------------------------------------------------------------------------------------------
7676template <class T >
77- OVERRIDE <T>::OVERRIDE (const T *overridable)
77+ OverridePtr <T>::OverridePtr (const T *overridable)
7878{
7979 m_overridable = overridable;
8080}
8181
8282// -------------------------------------------------------------------------------------------------
8383template <class T >
84- OVERRIDE <T>::OVERRIDE ( OVERRIDE <T> &overridable)
84+ OverridePtr <T>::OverridePtr(OverridePtr <T> &overridable)
8585{
8686 m_overridable = overridable.m_overridable ;
8787}
8888
8989// -------------------------------------------------------------------------------------------------
9090template <class T >
91- OVERRIDE <T> &OVERRIDE <T>::operator =( const OVERRIDE <T>& override )
91+ OverridePtr <T> &OverridePtr <T>::operator =( const OverridePtr <T>& other )
9292{
93- m_overridable = override .m_overridable ;
93+ m_overridable = other .m_overridable ;
9494 return *this ;
9595}
9696
9797// -------------------------------------------------------------------------------------------------
9898template <class T >
99- OVERRIDE <T> &OVERRIDE <T>::operator =(const T* overridable)
99+ OverridePtr <T> &OverridePtr <T>::operator =(const T* overridable)
100100{
101101 m_overridable = overridable;
102102 return *this ;
103103}
104104
105105// -------------------------------------------------------------------------------------------------
106106template <class T >
107- const T *OVERRIDE <T>::operator ->() const
107+ const T *OverridePtr <T>::operator ->() const
108108{
109109 if (!m_overridable)
110110 return nullptr ;
@@ -113,7 +113,7 @@ const T *OVERRIDE<T>::operator->() const
113113
114114// -------------------------------------------------------------------------------------------------
115115template <class T >
116- const T *OVERRIDE <T>::operator *() const
116+ const T *OverridePtr <T>::operator *() const
117117{
118118 if (!m_overridable)
119119 return nullptr ;
@@ -122,14 +122,14 @@ const T *OVERRIDE<T>::operator*() const
122122
123123// -------------------------------------------------------------------------------------------------
124124template <class T >
125- const T *OVERRIDE <T>::getNonOverloadedPointer( void ) const
125+ const T *OverridePtr <T>::getNonOverloadedPointer( void ) const
126126{
127127 return (T*) m_overridable;
128128}
129129
130130// -------------------------------------------------------------------------------------------------
131131template <class T >
132- OVERRIDE <T>::operator const T*( ) const
132+ OverridePtr <T>::operator const T*( ) const
133133{
134134 return operator *();
135135}
0 commit comments