ViewVC Help
View File | Revision Log | Show Annotations | View Changeset | Root Listing
root/OpenMD/trunk/src/antlr/ASTRefCount.cpp
Revision: 1442
Committed: Mon May 10 17:28:26 2010 UTC (14 years, 11 months ago) by gezelter
File size: 625 byte(s)
Log Message:
Adding property set to svn entries

File Contents

# User Rev Content
1 tim 770 /* ANTLR Translator Generator
2     * Project led by Terence Parr at http://www.jGuru.com
3     * Software rights: http://www.antlr.org/license.html
4     *
5 gezelter 1442 * $Id$
6 tim 770 */
7     #include "antlr/ASTRefCount.hpp"
8     #include "antlr/AST.hpp"
9    
10     #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
11     namespace antlr {
12     #endif
13    
14     ASTRef::ASTRef(AST* p)
15     : ptr(p), count(1)
16     {
17     if (p && !p->ref)
18     p->ref = this;
19     }
20    
21     ASTRef::~ASTRef()
22     {
23     delete ptr;
24     }
25    
26     ASTRef* ASTRef::getRef(const AST* p)
27     {
28     if (p) {
29     AST* pp = const_cast<AST*>(p);
30     if (pp->ref)
31     return pp->ref->increment();
32     else
33     return new ASTRef(pp);
34     } else
35     return 0;
36     }
37    
38     #ifdef ANTLR_CXX_SUPPORTS_NAMESPACE
39     }
40     #endif
41    

Properties

Name Value
svn:keywords Author Id Revision Date