ADT
        ast-experimental
      
      
        
          | Last change
 on this file since ff443e5 was             8f910430, checked in by Andrew Beach <ajbeach@…>, 4 years ago | 
        
          | 
Updated the virtual module to prefix the names with the new convention and change the parent_vtable into type_info.
 | 
        
          | 
              
Property                 mode
 set to                 100644 | 
        
          | File size:
            1.3 KB | 
      
      
| Rev | Line |  | 
|---|
| [a5f0529] | 1 | // | 
|---|
|  | 2 | // Cforall Version 1.0.0 Copyright (C) 2016 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 | // virtual.h -- Builtins for hierarchy objects. | 
|---|
|  | 8 | // | 
|---|
|  | 9 | // Author           : Andrew Beach | 
|---|
|  | 10 | // Created On       : Tus Jul 11 15:08:00 2017 | 
|---|
|  | 11 | // Last Modified By : Andrew Beach | 
|---|
| [8f910430] | 12 | // Last Modified On : Mon May 17 11:03:00 2021 | 
|---|
|  | 13 | // Update Count     : 2 | 
|---|
| [a5f0529] | 14 | // | 
|---|
|  | 15 |  | 
|---|
|  | 16 | #pragma once | 
|---|
|  | 17 |  | 
|---|
| [0cf5b79] | 18 | #ifdef __cforall | 
|---|
| [a5f0529] | 19 | extern "C" { | 
|---|
|  | 20 | #endif | 
|---|
|  | 21 |  | 
|---|
| [8f910430] | 22 | // Information on a type for the virtual system. | 
|---|
|  | 23 | // There should be exactly one instance per type and there should be a | 
|---|
|  | 24 | // pointer to it at the head of every virtual table. | 
|---|
|  | 25 | struct __cfavir_type_info { | 
|---|
|  | 26 | // Type id of parent type, null if this is a root type. | 
|---|
|  | 27 | struct __cfavir_type_info const * const parent; | 
|---|
| [a5f0529] | 28 | }; | 
|---|
|  | 29 |  | 
|---|
| [8f910430] | 30 | // A pointer to type information acts as the type id. | 
|---|
|  | 31 | typedef struct __cfavir_type_info const * __cfavir_type_id; | 
|---|
|  | 32 |  | 
|---|
|  | 33 | // Takes in two non-null type ids. | 
|---|
|  | 34 | int __cfavir_is_parent( | 
|---|
|  | 35 | __cfavir_type_id parent, __cfavir_type_id child ); | 
|---|
| [a5f0529] | 36 |  | 
|---|
|  | 37 | // If parent is a parent of child then return child, otherwise return NULL. | 
|---|
|  | 38 | // Input pointers are none-null, child's first level should be an object with | 
|---|
|  | 39 | // a vtable | 
|---|
| [8f910430] | 40 | void * __cfavir_virtual_cast( | 
|---|
|  | 41 | __cfavir_type_id parent, __cfavir_type_id const * child ); | 
|---|
| [a5f0529] | 42 |  | 
|---|
| [0cf5b79] | 43 | #ifdef __cforall | 
|---|
| [a5f0529] | 44 | } | 
|---|
|  | 45 | #endif | 
|---|
       
      
  Note:
 See   
TracBrowser
 for help on using the repository browser.