How to use the replication.share.yidl.src.yidl.cpp_target.CPPType 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
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()


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"
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):
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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()


class CPPExceptionType(CExceptionType, CPPType): pass
class CPPInclude(CInclude, CPPConstruct): pass
class CPPInterface(CInterface, CPPConstruct): pass
class CPPMapType(CMapType, CPPCompoundType): pass
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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() + "()"
    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"
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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"
    def getDummyValue( self ): return "std::string()"
    def getGetterDefinition( self, identifier ): return "const std::string& get_%(identifier)s() const { return %(identifier)s; }" % locals()
    def getIncludes( self ): return CStringType.getIncludes( self ) + [CPPInclude( self.getScope(), "string", False )]
    def getInConstructorDeclaration( self, identifier, default_value=None, with_stl=True ): 
        if with_stl:
            in_constructor_declaration = "const std::string& " + identifier
            if default_value is not None: in_constructor_declaration += " = " + str( default_value )
        else:
            if default_value is not None:
                default_value = str( default_value )
                in_constructor_declaration = "const char* %(identifier)s = %(default_value)s, %(identifier)s_len = strlen( %(default_value ) )" % locals()
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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()


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
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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"
    def getDummyValue( self ): return "std::string()"
    def getGetterDefinition( self, identifier ): return "const std::string& get_%(identifier)s() const { return %(identifier)s; }" % locals()
    def getIncludes( self ): return CStringType.getIncludes( self ) + [CPPInclude( self.getScope(), "string", False )]
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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( "::" )    


class CPPReferenceType(CReferenceType, CPPType): pass    
class CPPSequenceType(CSequenceType, CPPCompoundType): pass
github xtreemfs / babudb / replication / share / yidl / src / yidl / cpp_target.py View on Github external
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"
    def getDummyValue( self ): return "std::string()"
    def getGetterDefinition( self, identifier ): return "const std::string& get_%(identifier)s() const { return %(identifier)s; }" % locals()
    def getIncludes( self ): return CStringType.getIncludes( self ) + [CPPInclude( self.getScope(), "string", False )]
    def getInConstructorDeclaration( self, identifier, default_value=None, with_stl=True ): 
        if with_stl:
            in_constructor_declaration = "const std::string& " + identifier
            if default_value is not None: in_constructor_declaration += " = " + str( default_value )
        else:
            if default_value is not None:
                default_value = str( default_value )
                in_constructor_declaration = "const char* %(identifier)s = %(default_value)s, %(identifier)s_len = strlen( %(default_value ) )" % locals()
            else:
                in_constructor_declaration = "const char* %(identifier)s, size_t %(identifier)s_len" % locals()
        return in_constructor_declaration
    def getInConstructorInitialValue( self, identifier, with_stl=True ): return with_stl and identifier or ( "%(identifier)s, %(identifier)s_len" % locals() )