EMSchema Class Reference
Inherits from | NSObject |
Declared in | EMSchema.h EMSchema.m |
Overview
A set of meta-data describing a set of resources. Written by Bob Frankel and Carolyn Vaughan
Tasks
-
+ schemaFromFile:
Creates a EMResourceSchema instance from the contents of a file.
-
– accessForResource:
Get the read/write/indicator access capabilities of a named resource
-
– applicationResources
Returns a sorted NSArray containing all application resource names in this schema
-
– numberParametersForType:
Get the parameters associated with a number type.
-
– numericRepresentationForType:
Get the representation type associated with a number type.
-
– enumValuesForType:
Get the values associated with an enum type.
-
– fieldNamesForType:
Get the names of the fields associated with a struct type.
-
– fieldsForType:
Get the fields associated with a struct type.
-
– stringLengthForType:
Get the length of this string type.
-
– name
Returns the fully-qualified name of this schema.
-
– protocolLevel
Returns the protocol level of this schema
-
– resources
Returns an NSDictionary containing all resource names in this schema and their corresponding type code.
-
– maxResourceSize
Returns the maximum size in bytes amongst all resource types in this schema.
-
– byteAlignmentForResource:
Get the alignment of a named resource
-
– idForResource:
Get the unique id associated with a named resource
-
– nameForResourceWithID:
Get the resource name associated with this resource id
-
– sizeForResourceNamed:
Get the size of a named resource
-
– sizeForStandardType:
Get the size of a standard scalar type
-
– alignmentForStandardType:
Get the alignment of a standard scalar type
-
– systemResources
Returns a sorted NSArray containing all system resource names in this schema
-
– typeOfResourceNamed:
Get the type of a named resource
-
– owner
Returns the owner of the schema definition this schema was created from.
-
– version
Returns the version of the schema definition this schema was created from.
-
– schemaDescription
Returns the description associated with this schema.
-
– UUID
Returns the UUID associated with this schema.
-
– numericalUUID
Returns the UUID associated with this schema as an array of numbers.
-
– buildDate
Returns the build number associated with this schema as an array of numbers.
-
– schemaHash
Returns the schema hash associated with this schema as an array of numbers.
-
– broadcastResourceName
Returns the name of the resource that is being broadcast in the advertising packets. Returns nil if none.
-
– newResourceValueForResourceNamed:
Create a new ResourceValue instance for a named resource.
Class Methods
schemaFromFile:
Creates a EMResourceSchema instance from the contents of a file.
+ (EMSchema *)schemaFromFile:(NSString *)fileName
Parameters
- fileName
a file containing JSON content
Return Value
a newly created EMResourceSchema instance
Discussion
Creates a EMResourceSchema instance from the contents of a file.
Declared In
EMSchema.h
Instance Methods
UUID
Returns the UUID associated with this schema.
- (NSString *)UUID
Discussion
Returns the UUID associated with this schema.
Declared In
EMSchema.h
accessForResource:
Get the read/write/indicator access capabilities of a named resource
- (EMResourceAccessType)accessForResource:(NSString *)resourceName
Parameters
- resourceName
a valid resource name in this schema
Return Value
an NSString containing the characters ‘r’, ‘w’, and ‘i’ as appropriate
Discussion
Get the read/write/indicator access capabilities of a named resource
Exceptions
- UsageError
the resource name is invalid
Declared In
EMSchema.h
alignmentForStandardType:
Get the alignment of a standard scalar type
- (int)alignmentForStandardType:(NSString *)type
Parameters
- type
a scalar type code
Return Value
the alignment in bytes of this standard type
Discussion
Get the alignment of a standard scalar type
Exceptions
- UsageError
the type code is invalid
Declared In
EMSchema.h
applicationResources
Returns a sorted NSArray containing all application resource names in this schema
- (NSArray *)applicationResources
Discussion
Returns a sorted NSArray containing all application resource names in this schema
Declared In
EMSchema.h
broadcastResourceName
Returns the name of the resource that is being broadcast in the advertising packets. Returns nil if none.
- (NSString *)broadcastResourceName
Discussion
Returns the name of the resource that is being broadcast in the advertising packets. Returns nil if none.
Declared In
EMSchema.h
buildDate
Returns the build number associated with this schema as an array of numbers.
- (NSArray *)buildDate
Discussion
Returns the build number associated with this schema as an array of numbers.
Declared In
EMSchema.h
byteAlignmentForResource:
Get the alignment of a named resource
- (int)byteAlignmentForResource:(NSString *)resourceName
Parameters
- resourceName
a named resource in this schema
Return Value
the alignment in bytes of this resource
Discussion
Get the alignment of a named resource
Exceptions
- UsageError
the resource name is invalid
Declared In
EMSchema.h
enumValuesForType:
Get the values associated with an enum type.
- (NSDictionary *)enumValuesForType:(NSString *)type
Parameters
- type
a valid enum type name in this schema
Return Value
a NSDictionary containing enum value names and their corresponding ordinal
Discussion
Get the values associated with an enum type.
Exceptions
- UsageError
the enum type name is invalid
Declared In
EMSchema.h
fieldNamesForType:
Get the names of the fields associated with a struct type.
- (NSArray *)fieldNamesForType:(NSString *)type
Parameters
- type
a valid struct type name in this schema
Return Value
a NSArray containing field names
Discussion
Get the names of the fields associated with a struct type.
Exceptions
- UsageError
the struct type name is invalid
Declared In
EMSchema.h
fieldsForType:
Get the fields associated with a struct type.
- (NSDictionary *)fieldsForType:(NSString *)type
Parameters
- type
a valid struct type name in this schema
Return Value
a NSDictionary containing field names and their corresponding type code
Discussion
Get the fields associated with a struct type.
Exceptions
- UsageError
the struct type name is invalid
Declared In
EMSchema.h
idForResource:
Get the unique id associated with a named resource
- (int)idForResource:(NSString *)resourceName
Parameters
- resourceName
a named resource in this schema
Return Value
the corresponding resource id
Discussion
Get the unique id associated with a named resource
Exceptions
- UsageError
the resource name is invalid
Declared In
EMSchema.h
maxResourceSize
Returns the maximum size in bytes amongst all resource types in this schema.
- (int)maxResourceSize
Discussion
Returns the maximum size in bytes amongst all resource types in this schema.
Declared In
EMSchema.h
name
Returns the fully-qualified name of this schema.
- (NSString *)name
Discussion
Returns the fully-qualified name of this schema.
Declared In
EMSchema.h
nameForResourceWithID:
Get the resource name associated with this resource id
- (NSString *)nameForResourceWithID:(NSInteger)resourceId
Parameters
- resourceId
a resource id
Return Value
the corresponding resource name
Discussion
Get the resource name associated with this resource id
Exceptions
- UsageError
the resource id is invalid
See Also
Declared In
EMSchema.h
newResourceValueForResourceNamed:
Create a new ResourceValue instance for a named resource.
- (EMResourceValue *)newResourceValueForResourceNamed:(NSString *)resourceName
Parameters
- resourceName
a named resource in this schema
Return Value
a newly created EMResourceValue to a value for this resource
Discussion
Create a new ResourceValue instance for a named resource.
Exceptions
- UsageError
the resource name is invalid
Declared In
EMSchema.h
numberParametersForType:
Get the parameters associated with a number type.
- (NSArray *)numberParametersForType:(NSString *)type
Parameters
- type
a valid number type name in this schema
Return Value
a four-element NSArray holding the min, max, step, and prec parameters of this type
Discussion
Get the parameters associated with a number type.
Exceptions
- UsageError
the number type name is invalid
Declared In
EMSchema.h
numericRepresentationForType:
Get the representation type associated with a number type.
- (NSString *)numericRepresentationForType:(NSString *)type
Parameters
- type
a valid number type name in this schema
Return Value
an integral representation type
Discussion
Get the representation type associated with a number type.
Exceptions
- UsageError
the number type name is invalid
Declared In
EMSchema.h
numericalUUID
Returns the UUID associated with this schema as an array of numbers.
- (NSArray *)numericalUUID
Discussion
Returns the UUID associated with this schema as an array of numbers.
Declared In
EMSchema.h
owner
Returns the owner of the schema definition this schema was created from.
- (NSString *)owner
Discussion
Returns the owner of the schema definition this schema was created from.
Declared In
EMSchema.h
protocolLevel
Returns the protocol level of this schema
- (int)protocolLevel
Discussion
Returns the protocol level of this schema
Declared In
EMSchema.h
resources
Returns an NSDictionary containing all resource names in this schema and their corresponding type code.
- (NSDictionary *)resources
Discussion
Returns an NSDictionary containing all resource names in this schema and their corresponding type code.
Declared In
EMSchema.h
schemaDescription
Returns the description associated with this schema.
- (NSString *)schemaDescription
Discussion
Returns the description associated with this schema.
Declared In
EMSchema.h
schemaHash
Returns the schema hash associated with this schema as an array of numbers.
- (NSArray *)schemaHash
Discussion
Returns the schema hash associated with this schema as an array of numbers.
Declared In
EMSchema.h
sizeForResourceNamed:
Get the size of a named resource
- (int)sizeForResourceNamed:(NSString *)resourceName
Parameters
- resourceName
a named resource in this schema
Return Value
the size in bytes of this resource
Discussion
Get the size of a named resource
Exceptions
- UsageError
the resource name is invalid
Declared In
EMSchema.h
sizeForStandardType:
Get the size of a standard scalar type
- (int)sizeForStandardType:(NSString *)type
Parameters
- type
a scalar type code
Return Value
the size in bytes of this standard type
Discussion
Get the size of a standard scalar type
Exceptions
- UsageError
the type code is invalid
Declared In
EMSchema.h
stringLengthForType:
Get the length of this string type.
- (int)stringLengthForType:(NSString *)type
Parameters
- type
a valid string type name in this schema
Return Value
the length of this string type
Discussion
Get the length of this string type.
Exceptions
- UsageError
the string type name is invalid
Declared In
EMSchema.h
systemResources
Returns a sorted NSArray containing all system resource names in this schema
- (NSArray *)systemResources
Discussion
Returns a sorted NSArray containing all system resource names in this schema
Declared In
EMSchema.h
typeOfResourceNamed:
Get the type of a named resource
- (NSString *)typeOfResourceNamed:(NSString *)resourceName
Parameters
- resourceName
the name of a resource in this schema
Return Value
the type code associated with this resource
Discussion
Get the type of a named resource
Exceptions
- UsageError
the resource name is invalid
Declared In
EMSchema.h