// AddInstanceDomain will add a new instance domain to the current registry
AddInstanceDomain will add a new instance domain to the current registry
// AddInstanceDomain will add a new instance domain to the current registry
func (r *PCPRegistry) AddInstanceDomain(indom InstanceDomain) error {
	if r.HasInstanceDomain(indom.Name()) {
		return errors.New("InstanceDomain is already defined for the current registry")
	}
	r.indomlock.Lock()
	defer r.indomlock.Unlock()
	if r.mapped {
		return errors.New("Cannot add an indom when a mapping is active")
	}
	r.instanceDomains[indom.Name()] = indom.(*PCPInstanceDomain)
	r.instanceCount += indom.InstanceCount()
	if !r.version2 {
		for _, v := range indom.Instances() {
			if len(v) > MaxV1NameLength {
				r.version2 = true
			}
		}
	}
	if indom.(*PCPInstanceDomain).shortDescription != "" {
		r.stringcount++
	}
	if indom.(*PCPInstanceDomain).longDescription != "" {
		r.stringcount++
	}
	return nil
}
func ( r * PCPRegistry ) AddInstanceDomain ( indom InstanceDomain ) error { if r . HasInstanceDomain ( indom . Name ( ) ) { return errors . New ( " " ) } r . indomlock . Lock ( ) defer r . indomlock . Unlock ( ) if r . mapped { return errors . New ( " " ) } r . instanceDomains [ indom . Name ( ) ] = indom . ( * PCPInstanceDomain ) r . instanceCount += indom . InstanceCount ( ) if ! r . version2 { for _ , v := range indom . Instances ( ) { if len ( v ) > MaxV1NameLength { r . version2 = true } } } if indom . ( * PCPInstanceDomain ) . shortDescription != " " { r . stringcount ++ } if indom . ( * PCPInstanceDomain ) . longDescription != " " { r . stringcount ++ } return nil }
AddInstanceDomain will add a new instance domain to the current registry
AddInstanceDomain will add a new instance domain to the current registry