Documentation
¶
Overview ¶
Package idl provides support for CORBA IDL (Interface Definition Language) including parsing and code generation functionality
Index ¶
- func GenerateRepositoryID(modulePath []string, typeName string, version string) string
- func MarshalValue(value interface{}) (interface{}, error)
- func Register(orb *corba.ORB, objectName string, servant interface{}) error
- func UnmarshalValue(corbaValue interface{}, goType reflect.Type) (interface{}, error)
- type Any
- type Attribute
- type BaseType
- type BasicType
- type Direction
- type EnumType
- type Generator
- type Helper
- type InterfaceType
- type Module
- func (m *Module) AddSubmodule(name string) *Module
- func (m *Module) AddType(name string, typ Type)
- func (m *Module) AllTypes() map[string]Type
- func (m *Module) BuildRepositoryID(typeName string, version string) string
- func (m *Module) FullName() string
- func (m *Module) GetSubmodule(name string) (*Module, bool)
- func (m *Module) GetType(name string) (Type, bool)
- func (m *Module) GoPackageName() string
- func (m *Module) Path() []string
- type Operation
- type Parameter
- type Parser
- func (p *Parser) AddIncludeDir(dir string)
- func (p *Parser) GetRootModule() *Module
- func (p *Parser) Parse(reader io.Reader) error
- func (p *Parser) SetCurrentFile(filename string)
- func (p *Parser) SetIncludeDirs(dirs []string)
- func (p *Parser) SetIncludeHandler(handler func(string) (io.Reader, error))
- type Repository
- type ScopedType
- type SequenceType
- type ServantBase
- type SimpleType
- type StructField
- type StructType
- type StubFactory
- type TCKind
- type Type
- type TypeCode
- type TypeCodeMember
- type TypeDef
- type UnionCase
- type UnionType
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GenerateRepositoryID ¶
GenerateRepositoryID 根据模块前缀和类型名生成标准的 Repository ID
func MarshalValue ¶
func MarshalValue(value interface{}) (interface{}, error)
MarshalValue marshals a Go value to a CORBA value
func UnmarshalValue ¶
UnmarshalValue unmarshals a CORBA value to a Go value
Types ¶
type Any ¶
type Any struct {
TypeCode TypeCode
Value interface{}
}
Any represents a CORBA any type that can hold values of any type
type BaseType ¶
type BaseType struct {
RepositoryID string
}
BaseType 提供基本的类型功能,可以被其他类型嵌入
func (*BaseType) GetRepositoryID ¶
GetRepositoryID returns the repository ID
func (*BaseType) SetRepositoryID ¶
SetRepositoryID sets the repository ID
type BasicType ¶
type BasicType string
BasicType represents a primitive IDL type
const ( TypeShort BasicType = "short" TypeLong BasicType = "long" TypeLongLong BasicType = "long long" TypeUShort BasicType = "unsigned short" TypeULong BasicType = "unsigned long" TypeULongLong BasicType = "unsigned long long" TypeFloat BasicType = "float" TypeDouble BasicType = "double" TypeBoolean BasicType = "boolean" TypeChar BasicType = "char" TypeWChar BasicType = "wchar" TypeOctet BasicType = "octet" TypeAny BasicType = "any" TypeString BasicType = "string" TypeWString BasicType = "wstring" TypeVoid BasicType = "void" )
IDL Basic Types
type Direction ¶
type Direction string
Direction represents the parameter direction in IDL operations
type EnumType ¶
EnumType represents an IDL enum type
func (*EnumType) GoTypeName ¶
GoTypeName returns the corresponding Go type name
type Generator ¶
type Generator struct {
// contains filtered or unexported fields
}
Generator generates Go code from IDL definitions
func NewGenerator ¶
NewGenerator creates a new Go code generator for IDL
func (*Generator) AddInclude ¶
AddInclude adds an import to include in generated files
func (*Generator) Generate ¶
Generate generates Go code for all types in the module and its submodules
func (*Generator) SetPackageName ¶
SetPackageName sets the Go package name to use for generated code
type Helper ¶
type Helper interface {
// ID returns the repository ID for the type
ID() string
}
Helper is a base interface for all CORBA helper classes
type InterfaceType ¶
type InterfaceType struct {
BaseType
Name string
Module string
Parents []string
Operations []Operation
Attributes []Attribute
Types map[string]Type // Support for nested enums/types
}
InterfaceType represents an IDL interface type
func (*InterfaceType) GoTypeName ¶
func (t *InterfaceType) GoTypeName() string
GoTypeName returns the corresponding Go type name
func (*InterfaceType) TypeName ¶
func (t *InterfaceType) TypeName() string
TypeName returns the IDL type name
type Module ¶
type Module struct {
Name string
Parent *Module
Types map[string]Type
Submodules map[string]*Module
Prefix string // Repository ID prefix for this module
}
Module represents an IDL module that contains types
func (*Module) AddSubmodule ¶
AddSubmodule adds a submodule with the given name
func (*Module) BuildRepositoryID ¶
BuildRepositoryID 根据模块层次结构构建 Repository ID
func (*Module) GetSubmodule ¶
GetSubmodule gets a submodule by name
func (*Module) GoPackageName ¶
GoPackageName returns the Go package name for this module
type Operation ¶
type Operation struct {
Name string
ReturnType Type
Parameters []Parameter
Raises []string
Oneway bool
}
Operation represents an operation in an IDL interface
type Parser ¶
type Parser struct {
// contains filtered or unexported fields
}
Parser represents an IDL parser that reads and parses IDL files
func (*Parser) AddIncludeDir ¶
AddIncludeDir adds a directory to search for included files
func (*Parser) GetRootModule ¶
GetRootModule returns the root module containing all parsed types
func (*Parser) SetCurrentFile ¶
SetCurrentFile sets the name of the file currently being processed
func (*Parser) SetIncludeDirs ¶
SetIncludeDirs sets the directories to search for included files
type Repository ¶
type Repository struct {
// contains filtered or unexported fields
}
Repository represents an Interface Repository that stores IDL type information
func NewRepository ¶
func NewRepository() *Repository
NewRepository creates a new interface repository
func (*Repository) Get ¶
func (r *Repository) Get(id string) (Type, bool)
Get retrieves a type from the repository
func (*Repository) Register ¶
func (r *Repository) Register(id string, t Type)
Register adds a type to the repository
type ScopedType ¶
ScopedType 表示带有作用域的类型,例如 A::B::C
type SequenceType ¶
SequenceType represents an IDL sequence type
func (*SequenceType) GoTypeName ¶
func (t *SequenceType) GoTypeName() string
GoTypeName returns the corresponding Go type name
func (*SequenceType) TypeName ¶
func (t *SequenceType) TypeName() string
TypeName returns the IDL type name
type ServantBase ¶
type ServantBase struct {
// contains filtered or unexported fields
}
ServantBase is a base for all CORBA servants
func (*ServantBase) Dispatch ¶
func (s *ServantBase) Dispatch(methodName string, args []interface{}) (interface{}, error)
Dispatch dispatches a method call to the servant implementation
func (*ServantBase) SetDispatcher ¶
func (s *ServantBase) SetDispatcher(dispatcher func(methodName string, args []interface{}) (interface{}, error))
SetDispatcher sets the function that will handle method dispatching
type SimpleType ¶
SimpleType represents a basic IDL type
func (*SimpleType) GoTypeName ¶
func (t *SimpleType) GoTypeName() string
GoTypeName returns the corresponding Go type name
func (*SimpleType) TypeName ¶
func (t *SimpleType) TypeName() string
TypeName returns the IDL type name
type StructField ¶
StructField represents a field in an IDL struct
type StructType ¶
type StructType struct {
BaseType
Name string
Module string
Fields []StructField
}
StructType represents an IDL struct type
func (*StructType) GoTypeName ¶
func (t *StructType) GoTypeName() string
GoTypeName returns the corresponding Go type name
func (*StructType) TypeName ¶
func (t *StructType) TypeName() string
TypeName returns the IDL type name
type StubFactory ¶
type StubFactory struct {
// contains filtered or unexported fields
}
StubFactory creates client stubs for interfaces
func NewStubFactory ¶
func NewStubFactory(orb *corba.ORB, repo *Repository) *StubFactory
NewStubFactory creates a new factory for client stubs
func (*StubFactory) CreateStub ¶
func (f *StubFactory) CreateStub(objRef *corba.ObjectRef, interfaceName string) (interface{}, error)
CreateStub creates a new stub for a given interface
type Type ¶
type Type interface {
TypeName() string
GoTypeName() string
GetRepositoryID() string
SetRepositoryID(string)
}
Type is the interface for all IDL types
type TypeCode ¶
type TypeCode struct {
Kind TCKind
ID string
Name string
Length int
Content *TypeCode
Members []TypeCodeMember
}
TypeCode represents the metadata for a type
func TypeCodeFromValue ¶
TypeCodeFromValue creates a TypeCode from a Go value
type TypeCodeMember ¶
TypeCodeMember represents a member in a complex type
type TypeDef ¶
TypeDef represents an IDL typedef
func (*TypeDef) GoTypeName ¶
GoTypeName returns the corresponding Go type name
type UnionType ¶
UnionType represents an IDL union type
func (*UnionType) GoTypeName ¶
GoTypeName returns the corresponding Go type name