How to use the replication.share.yidl.src.yidl.cpp_target.CPPConstruct function in replication

To help you get started, we’ve selected a few replication examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
"CPPNumericType", 
           "CPPOperation", "CPPOperationParameter",
           "CPPPointerType",
           "CPPReferenceType",
           "CPPSequenceType", 
           "CPPStringType", 
           "CPPStructType",
           "CPPTarget",
          ]


class CPPConstruct:
    def getParentQualifiedNameMacro( self ): return "_".join( self.getQualifiedName()[:-1] ).upper() 


class CPPType(CPPConstruct):
    def getComparableValue( self, identifier ): return identifier
    def getConstant( self, identifier, value ): qname = self.getQualifiedName( "::" ); return "const static %(qname)s %(identifier)s = %(value)s;" % locals() 
    def getDeclarationTypeName( self ): return self.getQualifiedName( "::" )
    def getDefaultValue( self ): return None    
    def getDummyValue( self ): raise NotImplementedError
    def getGetterDefinition( self, identifier ): return self.getDeclarationTypeName() + " get_%(identifier)s() const { return %(identifier)s; }" % locals()
    def getInConstructorDeclaration( self, identifier, default_value=None, with_stl=True ): return self.getDeclarationTypeName() + lpad( " ", identifier ) + ( default_value is not None and ( " = " + str( default_value ) ) or "" ) 
    def getInConstructorInitialValue( self, identifier, with_stl=True ): return identifier    
    def getOutConstructorDeclaration( self, identifier, with_stl=True ): return self.getDeclarationTypeName() + ( not self.getDeclarationTypeName().endswith( "&" ) and "& " or "" ) + identifier
    def getSetterDefinitions( self, identifier ): qname = self.getDeclarationTypeName(); return ( "void set_%(identifier)s( %(qname)s %(identifier)s ) { this->%(identifier)s = %(identifier)s; }" % locals(), )    
    def getTempValueTypeName( self ): return self.getName()


class CPPCompoundType(CPPType):
    def getConstant( self, *args, **kwds ): raise NotImplementedError
    def getDummyValue( self ): return self.getDeclarationTypeName() + "()"
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
def getInConstructorInitialValue( self, identifier, with_stl=True ): return identifier    
    def getOutConstructorDeclaration( self, identifier, with_stl=True ): return self.getDeclarationTypeName() + ( not self.getDeclarationTypeName().endswith( "&" ) and "& " or "" ) + identifier
    def getSetterDefinitions( self, identifier ): qname = self.getDeclarationTypeName(); return ( "void set_%(identifier)s( %(qname)s %(identifier)s ) { this->%(identifier)s = %(identifier)s; }" % locals(), )    
    def getTempValueTypeName( self ): return self.getName()


class CPPCompoundType(CPPType):
    def getConstant( self, *args, **kwds ): raise NotImplementedError
    def getDummyValue( self ): return self.getDeclarationTypeName() + "()"
    def getGetterDefinition( self, identifier ): return "const " + self.getDeclarationTypeName() + "& get_%(identifier)s() const { return %(identifier)s; }" % locals()
    def getInConstructorDeclaration( self, identifier, default_value=None, with_stl=True ): return "const " + self.getDeclarationTypeName() + "& " + identifier     
    def getSetterDefinitions( self, identifier ): const_reference_decl = "const " + self.getDeclarationTypeName() + "& "; return ( """void set_%(identifier)s( %(const_reference_decl)s %(identifier)s ) { this->%(identifier)s = %(identifier)s; }""" % locals(), )
    def getTempValueTypeName( self ): return self.getDeclarationTypeName()
    

class CPPConstant(CConstant, CPPConstruct):
    def __repr__( self ):
        return self.getType().getConstant( self.getIdentifier(), self.getValue() ) 
    

class CPPBoolType(CBoolType, CPPType):
    def getDefaultValue( self ): return "false"
    def getDummyValue( self ): return "false"


class CPPBufferType(CBufferType, CPPType): pass


class CPPEnumeratedType(CEnumeratedType, CPPType):
    def getDefaultValue( self ):
        return self.getEnumerators()[0].getIdentifier()
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass    


class CPPModule(CModule, CPPConstruct):
    def __repr__( self ):            
        return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), "  " ) + "\n};\n"


class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass


class CPPPointerType(CPointerType, CPPType):
    def getDeclarationTypeName( self ):
        if self.getName() == "ptr" or self.getName() == "any":
            return "void*"
        else:
            return self.getQualifiedName( "::" )    


class CPPReferenceType(CReferenceType, CPPType): pass    
class CPPSequenceType(CSequenceType, CPPCompoundType): pass
    
    
class CPPStringType(CStringType, CPPType):
    def getDeclarationTypeName( self ): return "std::string"
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
class CPPBufferType(CBufferType, CPPType): pass


class CPPEnumeratedType(CEnumeratedType, CPPType):
    def getDefaultValue( self ):
        return self.getEnumerators()[0].getIdentifier()


class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass    


class CPPModule(CModule, CPPConstruct):
    def __repr__( self ):            
        return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), "  " ) + "\n};\n"


class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass


class CPPPointerType(CPointerType, CPPType):
    def getDeclarationTypeName( self ):
        if self.getName() == "ptr" or self.getName() == "any":
            return "void*"
        else:
            return self.getQualifiedName( "::" )
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
class CPPBoolType(CBoolType, CPPType):
    def getDefaultValue( self ): return "false"
    def getDummyValue( self ): return "false"


class CPPBufferType(CBufferType, CPPType): pass


class CPPEnumeratedType(CEnumeratedType, CPPType):
    def getDefaultValue( self ):
        return self.getEnumerators()[0].getIdentifier()


class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass    


class CPPModule(CModule, CPPConstruct):
    def __repr__( self ):            
        return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), "  " ) + "\n};\n"


class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass


class CPPPointerType(CPointerType, CPPType):
    def getDeclarationTypeName( self ):
        if self.getName() == "ptr" or self.getName() == "any":
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
class CPPBoolType(CBoolType, CPPType):
    def getDefaultValue( self ): return "false"
    def getDummyValue( self ): return "false"


class CPPBufferType(CBufferType, CPPType): pass


class CPPEnumeratedType(CEnumeratedType, CPPType):
    def getDefaultValue( self ):
        return self.getEnumerators()[0].getIdentifier()


class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass    


class CPPModule(CModule, CPPConstruct):
    def __repr__( self ):            
        return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), "  " ) + "\n};\n"


class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass


class CPPPointerType(CPointerType, CPPType):
    def getDeclarationTypeName( self ):
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
return self.getEnumerators()[0].getIdentifier()


class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass    


class CPPModule(CModule, CPPConstruct):
    def __repr__( self ):            
        return "namespace " + self.getName() + "\n{\n" + indent( CModule.__repr__( self ), "  " ) + "\n};\n"


class CPPNumericType(CNumericType, CPPType): pass
class CPPOperation(COperation, CPPConstruct): pass
class CPPOperationParameter(COperationParameter, CPPConstruct): pass


class CPPPointerType(CPointerType, CPPType):
    def getDeclarationTypeName( self ):
        if self.getName() == "ptr" or self.getName() == "any":
            return "void*"
        else:
            return self.getQualifiedName( "::" )    


class CPPReferenceType(CReferenceType, CPPType): pass    
class CPPSequenceType(CSequenceType, CPPCompoundType): pass
    
    
class CPPStringType(CStringType, CPPType):