File: Class-SDMXType.R

package info (click to toggle)
r-cran-rsdmx 1%3A0.5-13%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 984 kB
  • sloc: makefile: 2
file content (44 lines) | stat: -rw-r--r-- 1,396 bytes parent folder | download | duplicates (5)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
#' @name SDMXType
#' @docType class
#' @aliases SDMXType-class
#' @title Class "SDMXType"
#' 
#' @description A basic class to handle the type of a SDMX-ML document
#' 
#' @slot type Object of class "character" giving the type of the SDMX-ML document
#' 
#' @section Warning:
#' this class is not useful in itself, but all SDMX non-abstract classes will 
#' encapsulate it as slot, when parsing an SDMX-ML document.
#'          
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
#' 
setClass("SDMXType",
		representation(
				type = "character"
		),
		prototype = list(type = "SDMXGenericData"),
		validity = function(object){
      
      #validation rules
		  if(.rsdmx.options$validate){
  			type <- object@type;
  			valid <- switch(type,
                        "StructureType"             = TRUE,
                        "GenericDataType"           = TRUE,
                        "CompactDataType"           = TRUE,
                        "UtilityDataType"           = TRUE,
                        "StructureSpecificDataType" = TRUE,
                        "CrossSectionalDataType"    = TRUE,
                        "MessageGroupType"          = TRUE,
  					            FALSE
  			);
  			if(valid == FALSE)
  				warning(paste0("Unknown SDMXType ", type));
        
        return(valid)
		  }
      
			return(TRUE);
		}
)