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
 SAF_RelRep *
 saf_declare_relrep(SAF_ParMode pmode,
                    SAF_Db *db,                  /* Database in which to declare the new relation representation */
                    const char *name,            /* Name of the object */
                    const char *url,             /* An optional URL to the documentation */
                    int id,                      /* A unique non-negative identification number */
                    SAF_RelRep *buf              /* [OUT] Optional handle to fill in and return */
                    )
 {
     SAF_ENTER(saf_declare_relrep, NULL);
     ss_scope_t          scope;

     SAF_REQUIRE(_saf_valid_pmode(pmode), SAF_LOW_CHK_COST, NULL,
                 _saf_errmsg("PMODE must be valid"));
     if (!_saf_is_participating_proc(pmode)) SAF_RETURN(NULL);
     ss_file_topscope(db, &scope);
     buf = (ss_relrep_t*)ss_pers_new(&scope, SS_MAGIC(ss_relrep_t), NULL, SAF_ALL==pmode?SS_ALLSAME:0U, (ss_pers_t*)buf, NULL);

     if (SAF_EACH==pmode) SS_PERS_UNIQUE(buf);
     ss_string_set(SS_RELREP_P(buf,name), name);
     ss_string_set(SS_RELREP_P(buf,url), url);
     SS_RELREP(buf)->id = id;

     SAF_LEAVE(buf);
 }