File: Class-SDMXStructureType.R

package info (click to toggle)
r-cran-rsdmx 0.5.7%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: stretch
  • size: 940 kB
  • sloc: makefile: 2
file content (39 lines) | stat: -rw-r--r-- 1,351 bytes parent folder | download
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
#' @name SDMXStructureType
#' @docType class
#' @aliases SDMXStructureType-class
#' 
#' @title Class "SDMXStructureType"
#' @description A basic class to handle the type of a SDMX-ML Structure document
#' 
#' @section Warning:
#' This class is not useful in itself, but it will be used by \link{readSDMX} to
#' deal with SDMX-ML Structure documents.
#'    
#' @author Emmanuel Blondel, \email{emmanuel.blondel1@@gmail.com}
#'
setClass("SDMXStructureType",
         contains = "SDMXType",
         representation(subtype = "character"),
         prototype = list(),
         validity = function(object){
           
           #validation rules
           if(.rsdmx.options$validate){
             type <- getStructureType(object);
             valid <- switch(type,
                             "DataflowsType" = TRUE,
                             "ConceptsType" = TRUE,
                             "CodelistsType" = TRUE,
                             "DataStructuresType" = TRUE,
                             "DataStructureDefinitionsType" = TRUE,
                             FALSE
             );
             if(valid == FALSE)
               warning(paste0("Unknown SDMXStructureType '", type, "'"));
             
             return(valid);
           }
           
           return(TRUE);
         }
)