File: PointCut.h

package info (click to toggle)
aspectc%2B%2B 1.0pre4~svn.20090918-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 117,308 kB
  • ctags: 410,601
  • sloc: cpp: 1,883,007; ansic: 17,279; sh: 2,190; makefile: 1,088
file content (104 lines) | stat: -rw-r--r-- 3,793 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// This file is part of the AspectC++ compiler 'ac++'.
// Copyright (C) 1999-2003  The 'ac++' developers (see aspectc.org)
//                                                                
// This program is free software;  you can redistribute it and/or 
// modify it under the terms of the GNU General Public License as 
// published by the Free Software Foundation; either version 2 of 
// the License, or (at your option) any later version.            
//                                                                
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of 
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the  
// GNU General Public License for more details.                   
//                                                                
// You should have received a copy of the GNU General Public      
// License along with this program; if not, write to the Free     
// Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, 
// MA  02111-1307  USA                                            

/* $Id: PointCut.h,v 1.7 2004/09/07 10:57:16 olaf.spinczyk Exp $ */

#ifndef __PointCut_h__
#define __PointCut_h__

#include <iostream>
using namespace std;

#include "Puma/List.h"
#include "JoinPoint.h"
using namespace Puma;

namespace Puma {
  class CArgumentInfo;
} // namespace Puma

class PointCut : private List
 {
   public:
//      enum operation { PC_NOT, PC_AND, PC_OR };
      enum pctype { PCT_CODE, PCT_CLASS, PCT_UNKNOWN };

   private:
      pctype _type;
//      pccontents _contents; // shall replace _type someday
      list<PointCut*> _cflow_triggers;

   public:
      PointCut();
      ~PointCut ();
      PointCut& operator = (const PointCut& pc);

      // set and get the pointcut type
      void type (pctype t) { _type = t; }
      pctype type () const { return _type; }

//      // set and get the pointcut type based on the contents bit field
//      void contents (pccontents c) { _contents = c; }
//      void contents (pccontents ca, pccontents cb) { 
//	_contents = (pccontents)(_contents | ca | cb);
//      }
//
//      pccontents contents () const { return _contents; }
//      bool is (pccontents c) const { return (_contents & ~c) == 0; }
//      bool is_code () const { return (_contents & PC_NAME) == 0; }
//      bool is_name () const { return (_contents & PC_CODE) == 0; }
//      bool is_empty () const { return _contents == 0; }
//      bool is_mix () const { 
//	return (_contents & PC_NAME) != 0 && (_contents & PC_CODE) != 0;
//      }

      // set and get for cflow trigger pointcut
      void cflow_triggers (PointCut& pc);
      const list<PointCut*> &cflow_triggers();

      friend ostream& operator<< (ostream&, PointCut&);

      class iterator {
        const ListElement *_curr;
        List *_list;
      public:
        iterator (const ListElement *e, List *l) : _curr (e), _list (l) {}
        void operator ++ () { if (_curr) _curr = _list->next (_curr); }
        int operator == (const iterator &iter) const {
          return _curr == iter._curr && _list == iter._list; 
        }
        int operator != (const iterator &iter) const {
          return !(*this == iter);
        }
        const JoinPoint &operator * () { return (const JoinPoint&)*_curr; }
      };

      iterator begin () { return iterator (List::first (), this); }
      iterator end () { return iterator (0, this); }
#ifdef ACMODEL
      iterator find (ACM_Any *jpl);
#else
      iterator find (JoinPointLoc *jpl);
#endif

      void append (ListElement& element) { List::append (element); }
//      List& operator += (const PointCut& list) { return List::operator += (list); }
      void clear () { List::clear (); }
 };

#endif