ADT
        aaron-thesis
        arm-eh
        ast-experimental
        cleanup-dtors
        ctor
        deferred_resn
        demangler
        enum
        forall-pointer-decay
        gc_noraii
        jacob/cs343-translation
        jenkins-sandbox
        memory
        new-ast
        new-ast-unique-expr
        new-env
        no_list
        persistent-indexer
        pthread-emulation
        qualifiedEnum
        resolv-new
        with_gc
      
      
        
          | 
            Last change
 on this file since 2f6b7c9 was             cb4c607, checked in by Aaron Moss <a3moss@…>, 9 years ago           | 
        
        
          | 
             
Refactor Constant::from to disambiguate type 
 
           | 
        
        
          
            
              - 
Property                 mode
 set to                 
100644
               
             
           | 
        
        
          | 
            File size:
            1.5 KB
           | 
        
      
      
| Rev | Line |   | 
|---|
| [0dd3a2f] | 1 | //
 | 
|---|
 | 2 | // Cforall Version 1.0.0 Copyright (C) 2015 University of Waterloo
 | 
|---|
 | 3 | //
 | 
|---|
 | 4 | // The contents of this file are covered under the licence agreement in the
 | 
|---|
 | 5 | // file "LICENCE" distributed with Cforall.
 | 
|---|
 | 6 | //
 | 
|---|
 | 7 | // Constant.h -- 
 | 
|---|
 | 8 | //
 | 
|---|
 | 9 | // Author           : Richard C. Bilson
 | 
|---|
 | 10 | // Created On       : Mon May 18 07:44:20 2015
 | 
|---|
 | 11 | // Last Modified By : Peter A. Buhr
 | 
|---|
| [7f5566b] | 12 | // Last Modified On : Thu Jul 30 15:19:16 2015
 | 
|---|
 | 13 | // Update Count     : 5
 | 
|---|
| [0dd3a2f] | 14 | //
 | 
|---|
| [51b73452] | 15 | 
 | 
|---|
 | 16 | #ifndef CONSTANT_H
 | 
|---|
 | 17 | #define CONSTANT_H
 | 
|---|
 | 18 | 
 | 
|---|
 | 19 | #include "SynTree.h"
 | 
|---|
 | 20 | #include "Visitor.h"
 | 
|---|
 | 21 | #include "Mutator.h"
 | 
|---|
 | 22 | 
 | 
|---|
| [0dd3a2f] | 23 | class Constant {
 | 
|---|
 | 24 |   public:
 | 
|---|
 | 25 |         Constant( Type *type, std::string value );
 | 
|---|
| [7f5566b] | 26 |         Constant( const Constant &other );
 | 
|---|
| [0dd3a2f] | 27 |         virtual ~Constant();
 | 
|---|
 | 28 | 
 | 
|---|
 | 29 |         Type *get_type() { return type; }
 | 
|---|
 | 30 |         void set_type( Type *newValue ) { type = newValue; }
 | 
|---|
 | 31 |         std::string get_value() { return value; }
 | 
|---|
 | 32 |         void set_value( std::string newValue ) { value = newValue; }
 | 
|---|
 | 33 | 
 | 
|---|
| [9d7b3ea] | 34 |         /// generates an integer constant of the given int
 | 
|---|
| [cb4c607] | 35 |         static Constant from_int( int i );
 | 
|---|
| [9d7b3ea] | 36 |         /// generates an integer constant of the given unsigned long int
 | 
|---|
| [cb4c607] | 37 |         static Constant from_ulong( unsigned long i );
 | 
|---|
| [9d7b3ea] | 38 |         /// generates a floating point constant of the given double
 | 
|---|
| [cb4c607] | 39 |         static Constant from_double( double d );
 | 
|---|
| [9d7b3ea] | 40 | 
 | 
|---|
| [0dd3a2f] | 41 |         virtual Constant *clone() const;
 | 
|---|
 | 42 |         virtual void accept( Visitor &v ) { v.visit( this ); }
 | 
|---|
 | 43 |         virtual Constant *acceptMutator( Mutator &m ) { return m.mutate( this ); }
 | 
|---|
 | 44 |         virtual void print( std::ostream &os ) const;
 | 
|---|
 | 45 |   private:
 | 
|---|
 | 46 |         Type *type;
 | 
|---|
 | 47 |         std::string value;
 | 
|---|
| [51b73452] | 48 | };
 | 
|---|
 | 49 | 
 | 
|---|
| [0dd3a2f] | 50 | #endif // CONSTANT_H
 | 
|---|
| [51b73452] | 51 | 
 | 
|---|
| [0dd3a2f] | 52 | // Local Variables: //
 | 
|---|
 | 53 | // tab-width: 4 //
 | 
|---|
 | 54 | // mode: c++ //
 | 
|---|
 | 55 | // compile-command: "make install" //
 | 
|---|
 | 56 | // End: //
 | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.