| 1 |
|
|---|
| 2 |
|
|---|
| 3 |
use strict; |
|---|
| 4 |
|
|---|
| 5 |
my $gfc; |
|---|
| 6 |
my $gfcdXml = ''; |
|---|
| 7 |
my $currElem; |
|---|
| 8 |
|
|---|
| 9 |
my $filePrefix = "OSG"; |
|---|
| 10 |
my $decFileSuffix = ".h"; |
|---|
| 11 |
my $inlFileSuffix = ".inl"; |
|---|
| 12 |
my $impFileSuffix = ".cpp"; |
|---|
| 13 |
|
|---|
| 14 |
my $baseTmplCpp = "FCBaseTemplate_cpp.h"; |
|---|
| 15 |
my $baseTmplH = "FCBaseTemplate_h.h"; |
|---|
| 16 |
my $baseTmplInl = "FCBaseTemplate_inl.h"; |
|---|
| 17 |
|
|---|
| 18 |
my $fieldImpH = "FCFieldsTemplate_h.h"; |
|---|
| 19 |
|
|---|
| 20 |
my $fcTmplCpp = "FCTemplate_cpp.h"; |
|---|
| 21 |
my $fcTmplH = "FCTemplate_h.h"; |
|---|
| 22 |
my $fcTmplInl = "FCTemplate_inl.h"; |
|---|
| 23 |
|
|---|
| 24 |
my $enableCompat = 0; |
|---|
| 25 |
|
|---|
| 26 |
sub start_element |
|---|
| 27 |
{ |
|---|
| 28 |
my ($self,$localname) = @_; |
|---|
| 29 |
|
|---|
| 30 |
if($localname eq "FieldContainer") |
|---|
| 31 |
{ |
|---|
| 32 |
|
|---|
| 33 |
|
|---|
| 34 |
$gfc = new OSGFieldContainer; |
|---|
| 35 |
|
|---|
| 36 |
while(@_) |
|---|
| 37 |
{ |
|---|
| 38 |
my $key = shift; |
|---|
| 39 |
my $val = shift; |
|---|
| 40 |
|
|---|
| 41 |
$gfc->{$key} = $val; |
|---|
| 42 |
} |
|---|
| 43 |
|
|---|
| 44 |
my @fArray = (); |
|---|
| 45 |
my $fArrayRef = \@fArray; |
|---|
| 46 |
|
|---|
| 47 |
$gfc->{fields} = $fArrayRef; |
|---|
| 48 |
|
|---|
| 49 |
$currElem = $gfc; |
|---|
| 50 |
} |
|---|
| 51 |
|
|---|
| 52 |
if($localname eq "Field") |
|---|
| 53 |
{ |
|---|
| 54 |
|
|---|
| 55 |
|
|---|
| 56 |
my $field = new OSGField; |
|---|
| 57 |
|
|---|
| 58 |
while(@_) |
|---|
| 59 |
{ |
|---|
| 60 |
my $key = shift; |
|---|
| 61 |
my $val = shift; |
|---|
| 62 |
|
|---|
| 63 |
$field->{$key} = $val; |
|---|
| 64 |
} |
|---|
| 65 |
|
|---|
| 66 |
my $fArrayRef = $gfc->{fields}; |
|---|
| 67 |
|
|---|
| 68 |
push @$fArrayRef, $field; |
|---|
| 69 |
|
|---|
| 70 |
$currElem = $field; |
|---|
| 71 |
} |
|---|
| 72 |
} |
|---|
| 73 |
|
|---|
| 74 |
sub end_element |
|---|
| 75 |
{ |
|---|
| 76 |
} |
|---|
| 77 |
|
|---|
| 78 |
sub characters |
|---|
| 79 |
{ |
|---|
| 80 |
my $self = shift; |
|---|
| 81 |
|
|---|
| 82 |
my $a1 = shift; |
|---|
| 83 |
|
|---|
| 84 |
if($a1 ne "\n" && $a1 ne "\t") |
|---|
| 85 |
{ |
|---|
| 86 |
$currElem->{description} .= "$a1\n"; |
|---|
| 87 |
|
|---|
| 88 |
} |
|---|
| 89 |
} |
|---|
| 90 |
|
|---|
| 91 |
package OSGFieldContainer; |
|---|
| 92 |
use strict; |
|---|
| 93 |
|
|---|
| 94 |
sub new |
|---|
| 95 |
{ |
|---|
| 96 |
my $class = shift; |
|---|
| 97 |
my $self = {}; |
|---|
| 98 |
|
|---|
| 99 |
$self->{name} = "<UNDEF>"; |
|---|
| 100 |
$self->{parent} = "<UNDEF>"; |
|---|
| 101 |
$self->{library} = "<UNDEF>"; |
|---|
| 102 |
$self->{pointerfieldtypes} = "none"; |
|---|
| 103 |
$self->{structure} = "<UNDEF>"; |
|---|
| 104 |
$self->{systemcomponent} = "true"; |
|---|
| 105 |
$self->{parentsystemcomponent} = "true"; |
|---|
| 106 |
$self->{decoratable} = "false"; |
|---|
| 107 |
$self->{useLocalIncludes} = "false"; |
|---|
| 108 |
$self->{isNodeCore} = "false"; |
|---|
| 109 |
$self->{description} = ""; |
|---|
| 110 |
$self->{group} = "NULL"; |
|---|
| 111 |
$self->{namespace} = 0; |
|---|
| 112 |
$self->{decorateeFieldFlags} = ""; |
|---|
| 113 |
$self->{CompatOneSix} = "false"; |
|---|
| 114 |
|
|---|
| 115 |
bless $self, $class |
|---|
| 116 |
} |
|---|
| 117 |
|
|---|
| 118 |
sub isSystemComponent |
|---|
| 119 |
{ |
|---|
| 120 |
my $self = shift; |
|---|
| 121 |
|
|---|
| 122 |
return $self->{systemcomponent}; |
|---|
| 123 |
} |
|---|
| 124 |
|
|---|
| 125 |
sub isDecoratable |
|---|
| 126 |
{ |
|---|
| 127 |
my $self = shift; |
|---|
| 128 |
|
|---|
| 129 |
return $self->{isDecoratable}; |
|---|
| 130 |
} |
|---|
| 131 |
|
|---|
| 132 |
sub hasFields |
|---|
| 133 |
{ |
|---|
| 134 |
my $self = shift; |
|---|
| 135 |
|
|---|
| 136 |
return $self->{hasFields}; |
|---|
| 137 |
} |
|---|
| 138 |
|
|---|
| 139 |
sub addFieldIdsAndMasksDecl |
|---|
| 140 |
{ |
|---|
| 141 |
my $self = shift; |
|---|
| 142 |
my $destRef = shift; |
|---|
| 143 |
my $tmpLine; |
|---|
| 144 |
|
|---|
| 145 |
my $fArrayRef = $self->{fields}; |
|---|
| 146 |
my @aArrayField = @{$self->{fields}}; |
|---|
| 147 |
|
|---|
| 148 |
if($self->{hasFields} eq "false") |
|---|
| 149 |
{ |
|---|
| 150 |
return; |
|---|
| 151 |
} |
|---|
| 152 |
|
|---|
| 153 |
push(@$destRef, " enum\n"); |
|---|
| 154 |
push(@$destRef, " {\n"); |
|---|
| 155 |
|
|---|
| 156 |
$tmpLine = " "; |
|---|
| 157 |
$tmpLine .= $aArrayField[0]->{Fieldname}; |
|---|
| 158 |
$tmpLine .= "FieldId = Inherited::NextFieldId,\n"; |
|---|
| 159 |
|
|---|
| 160 |
push(@$destRef, $tmpLine); |
|---|
| 161 |
|
|---|
| 162 |
|
|---|
| 163 |
for(my $i = 1; $i <= $#aArrayField; $i++) |
|---|
| 164 |
{ |
|---|
| 165 |
$tmpLine = " "; |
|---|
| 166 |
$tmpLine .= $aArrayField[$i]->{Fieldname}; |
|---|
| 167 |
$tmpLine .= "FieldId = "; |
|---|
| 168 |
$tmpLine .= $aArrayField[$i - 1]->{Fieldname}; |
|---|
| 169 |
$tmpLine .= "FieldId + 1,\n"; |
|---|
| 170 |
|
|---|
| 171 |
push(@$destRef, $tmpLine); |
|---|
| 172 |
} |
|---|
| 173 |
|
|---|
| 174 |
|
|---|
| 175 |
$tmpLine = " "; |
|---|
| 176 |
$tmpLine .= "NextFieldId = "; |
|---|
| 177 |
$tmpLine .= $aArrayField[$#aArrayField]->{Fieldname}; |
|---|
| 178 |
$tmpLine .= "FieldId + 1\n"; |
|---|
| 179 |
|
|---|
| 180 |
push(@$destRef, $tmpLine); |
|---|
| 181 |
|
|---|
| 182 |
push(@$destRef, " };\n\n"); |
|---|
| 183 |
|
|---|
| 184 |
for(my $i = 0; $i <= $#aArrayField; $i++) |
|---|
| 185 |
{ |
|---|
| 186 |
$tmpLine = " static const OSG::BitVector "; |
|---|
| 187 |
$tmpLine .= $aArrayField[$i]->{Fieldname}; |
|---|
| 188 |
$tmpLine .= "FieldMask = \n"; |
|---|
| 189 |
|
|---|
| 190 |
push(@$destRef, $tmpLine); |
|---|
| 191 |
|
|---|
| 192 |
$tmpLine = " (TypeTraits<BitVector>::One << "; |
|---|
| 193 |
$tmpLine .= $aArrayField[$i]->{Fieldname}; |
|---|
| 194 |
$tmpLine .= "FieldId);\n"; |
|---|
| 195 |
|
|---|
| 196 |
push(@$destRef, $tmpLine); |
|---|
| 197 |
} |
|---|
| 198 |
|
|---|
| 199 |
$tmpLine = " static const OSG::BitVector NextFieldMask = \n"; |
|---|
| 200 |
|
|---|
| 201 |
push(@$destRef, $tmpLine); |
|---|
| 202 |
|
|---|
| 203 |
$tmpLine = " (TypeTraits<BitVector>::One << NextFieldId);\n"; |
|---|
| 204 |
|
|---|
| 205 |
push(@$destRef, $tmpLine); |
|---|
| 206 |
|
|---|
| 207 |
} |
|---|
| 208 |
|
|---|
| 209 |
sub addAdditionaIncludes |
|---|
| 210 |
{ |
|---|
| 211 |
my $self = shift; |
|---|
| 212 |
my $destRef = shift; |
|---|
| 213 |
my $tmpLine; |
|---|
| 214 |
|
|---|
| 215 |
if(exists $self->{'additionalIncludes'}) |
|---|
| 216 |
{ |
|---|
| 217 |
my @addIncludes = split(/,/,$self->{'additionalIncludes'}); |
|---|
| 218 |
|
|---|
| 219 |
|
|---|
| 220 |
for my $addInclude (@addIncludes) |
|---|
| 221 |
{ |
|---|
| 222 |
push(@$destRef, "#include <$addInclude>"); |
|---|
| 223 |
} |
|---|
| 224 |
} |
|---|
| 225 |
} |
|---|
| 226 |
|
|---|
| 227 |
sub setupDecorator |
|---|
| 228 |
{ |
|---|
| 229 |
my $self = shift; |
|---|
| 230 |
|
|---|
| 231 |
$self->{Classname} = $self->{name}."Decorator"; |
|---|
| 232 |
$self->{CLASSNAME} = uc($self->{name})."DECORATOR"; |
|---|
| 233 |
$self->{Parent} = $self->{name}; |
|---|
| 234 |
} |
|---|
| 235 |
|
|---|
| 236 |
sub setupFieldContainer |
|---|
| 237 |
{ |
|---|
| 238 |
my $self = shift; |
|---|
| 239 |
|
|---|
| 240 |
$self->{Classname} = $self->{name}; |
|---|
| 241 |
$self->{CLASSNAME} = uc($self->{name}); |
|---|
| 242 |
$self->{Parent} = $self->{parent}; |
|---|
| 243 |
} |
|---|
| 244 |
|
|---|
| 245 |
sub finalize |
|---|
| 246 |
{ |
|---|
| 247 |
my $self = shift; |
|---|
| 248 |
|
|---|
| 249 |
my $fArrayRef = $self->{fields}; |
|---|
| 250 |
my @aArrayField = @{$self->{fields}}; |
|---|
| 251 |
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 |
if($ |
|---|
| 255 |
{ |
|---|
| 256 |
${self}->{hasFields} = "true"; |
|---|
| 257 |
} |
|---|
| 258 |
else |
|---|
| 259 |
{ |
|---|
| 260 |
${self}->{hasFields} = "false"; |
|---|
| 261 |
} |
|---|
| 262 |
|
|---|
| 263 |
if(exists ${self}->{library}) |
|---|
| 264 |
{ |
|---|
| 265 |
${self}->{Library} = "true"; |
|---|
| 266 |
${self}->{Libname} = ${self}->{library}; |
|---|
| 267 |
${self}->{LIBNAME} = uc(${self}->{library}); |
|---|
| 268 |
} |
|---|
| 269 |
else |
|---|
| 270 |
{ |
|---|
| 271 |
${self}->{Library} = "false"; |
|---|
| 272 |
${self}->{Libname} = "<UNDEF>"; |
|---|
| 273 |
${self}->{LIBNAME} = "<UNDEF>"; |
|---|
| 274 |
} |
|---|
| 275 |
|
|---|
| 276 |
$self->{CLASSNAME} = uc($self->{name}); |
|---|
| 277 |
$self->{Classname} = $self->{name}; |
|---|
| 278 |
$self->{isDecoratable} = $self->{decoratable}; |
|---|
| 279 |
$self->{Parent} = $self->{parent}; |
|---|
| 280 |
|
|---|
| 281 |
if($self->{structure} eq "concrete") |
|---|
| 282 |
{ |
|---|
| 283 |
$self->{Abstract} = "false"; |
|---|
| 284 |
} |
|---|
| 285 |
else |
|---|
| 286 |
{ |
|---|
| 287 |
$self->{Abstract} = "true"; |
|---|
| 288 |
} |
|---|
| 289 |
|
|---|
| 290 |
if($self->{parentsystemcomponent} eq "true" && |
|---|
| 291 |
$self->{systemcomponent} eq "false" ) |
|---|
| 292 |
{ |
|---|
| 293 |
$self->{ParentHeaderPrefix} = "OpenSG/"; |
|---|
| 294 |
} |
|---|
| 295 |
else |
|---|
| 296 |
{ |
|---|
| 297 |
$self->{ParentHeaderPrefix} = ""; |
|---|
| 298 |
} |
|---|
| 299 |
|
|---|
| 300 |
if($self->{systemcomponent} eq "false") |
|---|
| 301 |
{ |
|---|
| 302 |
$self->{HeaderPrefix} = "OpenSG/"; |
|---|
| 303 |
} |
|---|
| 304 |
else |
|---|
| 305 |
{ |
|---|
| 306 |
$self->{HeaderPrefix} = ""; |
|---|
| 307 |
} |
|---|
| 308 |
|
|---|
| 309 |
$self->{hasPrivateFields} = "false"; |
|---|
| 310 |
$self->{hasProtectedFields} = "false"; |
|---|
| 311 |
$self->{hasPublicFields} = "false"; |
|---|
| 312 |
$self->{hasPtrFields} = "false"; |
|---|
| 313 |
|
|---|
| 314 |
my @sfArray = (); |
|---|
| 315 |
my @mfArray = (); |
|---|
| 316 |
|
|---|
| 317 |
|
|---|
| 318 |
|
|---|
| 319 |
for my $field (@$fArrayRef) |
|---|
| 320 |
{ |
|---|
| 321 |
$field->finalize($self); |
|---|
| 322 |
|
|---|
| 323 |
if($field->isPrivate() eq "true") |
|---|
| 324 |
{ |
|---|
| 325 |
$self->{hasPrivateFields} = "true"; |
|---|
| 326 |
} |
|---|
| 327 |
|
|---|
| 328 |
if($field->isProtected() eq "true") |
|---|
| 329 |
{ |
|---|
| 330 |
$self->{hasProtectedFields} = "true"; |
|---|
| 331 |
} |
|---|
| 332 |
|
|---|
| 333 |
if($field->isPublic() eq "true") |
|---|
| 334 |
{ |
|---|
| 335 |
$self->{hasPublicFields} = "true"; |
|---|
| 336 |
} |
|---|
| 337 |
|
|---|
| 338 |
if($field->isSField() eq "true") |
|---|
| 339 |
{ |
|---|
| 340 |
push(@sfArray, $field); |
|---|
| 341 |
} |
|---|
| 342 |
|
|---|
| 343 |
if($field->isMField() eq "true") |
|---|
| 344 |
{ |
|---|
| 345 |
push(@mfArray, $field); |
|---|
| 346 |
} |
|---|
| 347 |
|
|---|
| 348 |
if($field->isPtrField() eq "true") |
|---|
| 349 |
{ |
|---|
| 350 |
$self->{hasPtrFields} = "true"; |
|---|
| 351 |
} |
|---|
| 352 |
} |
|---|
| 353 |
|
|---|
| 354 |
if($ |
|---|
| 355 |
{ |
|---|
| 356 |
$$fArrayRef[$ |
|---|
| 357 |
} |
|---|
| 358 |
|
|---|
| 359 |
my $sfArrayRef = \@sfArray; |
|---|
| 360 |
my $mfArrayRef = \@mfArray; |
|---|
| 361 |
|
|---|
| 362 |
$self->{SFields} = $sfArrayRef; |
|---|
| 363 |
$self->{MFields} = $mfArrayRef; |
|---|
| 364 |
|
|---|
| 365 |
$self->{abstract} = "false"; |
|---|
| 366 |
|
|---|
| 367 |
if($self->{structure} eq "concrete") |
|---|
| 368 |
{ |
|---|
| 369 |
$self->{abstract} = "false"; |
|---|
| 370 |
} |
|---|
| 371 |
|
|---|
| 372 |
if($self->{structure} eq "abstract") |
|---|
| 373 |
{ |
|---|
| 374 |
$self->{abstract} = "true"; |
|---|
| 375 |
} |
|---|
| 376 |
|
|---|
| 377 |
$self->{Pointerfield} = "false"; |
|---|
| 378 |
$self->{SFPointerfield} = "false"; |
|---|
| 379 |
$self->{MFPointerfield} = "false"; |
|---|
| 380 |
|
|---|
| 381 |
if($self->{pointerfieldtypes} eq "both") |
|---|
| 382 |
{ |
|---|
| 383 |
$self->{Pointerfield} = "true"; |
|---|
| 384 |
$self->{SFPointerfield} = "true"; |
|---|
| 385 |
$self->{MFPointerfield} = "true"; |
|---|
| 386 |
} |
|---|
| 387 |
|
|---|
| 388 |
if($self->{pointerfieldtypes} eq "single") |
|---|
| 389 |
{ |
|---|
| 390 |
$self->{Pointerfield} = "true"; |
|---|
| 391 |
$self->{SFPointerfield} = "true"; |
|---|
| 392 |
} |
|---|
| 393 |
|
|---|
| 394 |
if($self->{pointerfieldtypes} eq "multi") |
|---|
| 395 |
{ |
|---|
| 396 |
$self->{Pointerfield} = "true"; |
|---|
| 397 |
$self->{MFPointerfield} = "true"; |
|---|
| 398 |
} |
|---|
| 399 |
|
|---|
| 400 |
$self->{Description} = $self->{description}; |
|---|
| 401 |
my $safe_desc = $self->{description}; |
|---|
| 402 |
$safe_desc =~ s/"/\\\\\\"/g; |
|---|
| 403 |
$safe_desc =~ s/\n/\\\\n/g; |
|---|
| 404 |
$self->{SafeDescription} = $safe_desc; |
|---|
| 405 |
|
|---|
| 406 |
$self->{SystemComponent} = $self->{systemcomponent}; |
|---|
| 407 |
|
|---|
| 408 |
$self->{FieldMethodType} = ""; |
|---|
| 409 |
|
|---|
| 410 |
if($self->isDecoratable() eq "true") |
|---|
| 411 |
{ |
|---|
| 412 |
$self->{FieldMethodType} = "virtual"; |
|---|
| 413 |
} |
|---|
| 414 |
|
|---|
| 415 |
$self->{Group} = $self->{group}; |
|---|
| 416 |
$self->{Namespace} = $self->{namespace}; |
|---|
| 417 |
|
|---|
| 418 |
if($self->{decorateeFieldFlags} eq "") |
|---|
| 419 |
{ |
|---|
| 420 |
$self->{decorateeFieldFlags} = "Field::SFDefaultFlags"; |
|---|
| 421 |
} |
|---|
| 422 |
else |
|---|
| 423 |
{ |
|---|
| 424 |
my @flags = split(/[,]/, $self->{decorateeFieldFlags}); |
|---|
| 425 |
|
|---|
| 426 |
$self->{decorateeFieldFlags} = "("; |
|---|
| 427 |
|
|---|
| 428 |
for(my $i = 0; $i <= $#flags; ++$i) |
|---|
| 429 |
{ |
|---|
| 430 |
my $flag = $flags[$i]; |
|---|
| 431 |
|
|---|
| 432 |
$flag =~ s/ //g; |
|---|
| 433 |
$flag =~ s/\t//g; |
|---|
| 434 |
$flag =~ s/\n//g; |
|---|
| 435 |
|
|---|
| 436 |
if($i == 0 && $i != $#flags) |
|---|
| 437 |
{ |
|---|
| 438 |
$self->{decorateeFieldFlags} .= "Field::".$flag." |"; |
|---|
| 439 |
|
|---|
| 440 |
next; |
|---|
| 441 |
} |
|---|
| 442 |
|
|---|
| 443 |
if($i == $#flags) |
|---|
| 444 |
{ |
|---|
| 445 |
if($i == 0) |
|---|
| 446 |
{ |
|---|
| 447 |
$self->{decorateeFieldFlags} .= "Field::".$flag; |
|---|
| 448 |
} |
|---|
| 449 |
else |
|---|
| 450 |
{ |
|---|
| 451 |
$self->{decorateeFieldFlags} .= " Field::".$flag; |
|---|
| 452 |
} |
|---|
| 453 |
|
|---|
| 454 |
next; |
|---|
| 455 |
} |
|---|
| 456 |
|
|---|
| 457 |
$self->{decorateeFieldFlags} .= " Field::".$flag." |"; |
|---|
| 458 |
} |
|---|
| 459 |
|
|---|
| 460 |
$self->{fdecorateeFieldFlags} .= ")"; |
|---|
| 461 |
} |
|---|
| 462 |
|
|---|
| 463 |
if($enableCompat == 1) |
|---|
| 464 |
{ |
|---|
| 465 |
$self->{CompatOneSix} = "true"; |
|---|
| 466 |
} |
|---|
| 467 |
else |
|---|
| 468 |
{ |
|---|
| 469 |
$self->{CompatOneSix} = "false"; |
|---|
| 470 |
} |
|---|
| 471 |
} |
|---|
| 472 |
|
|---|
| 473 |
sub dumpValues |
|---|
| 474 |
{ |
|---|
| 475 |
my $self = shift; |
|---|
| 476 |
|
|---|
| 477 |
print "FieldContainer\n"; |
|---|
| 478 |
print "\tname : $self->{name}\n"; |
|---|
| 479 |
print "\tparent : $self->{parent}\n"; |
|---|
| 480 |
print "\tlibrary : $self->{library}\n"; |
|---|
| 481 |
print "\tpointerfieldtypes : $self->{pointerfieldtypes}\n"; |
|---|
| 482 |
print "\tstructure : $self->{structure}\n"; |
|---|
| 483 |
print "\tsystemcomponent : $self->{systemcomponent}\n"; |
|---|
| 484 |
print "\tparentsystemcomponent : $self->{parentsystemcomponent}\n"; |
|---|
| 485 |
print "\tdecoratable : $self->{decoratable}\n"; |
|---|
| 486 |
print "\tuseLocalIncludes : $self->{useLocalIncludes}\n"; |
|---|
| 487 |
print "\tgroup : $self->{group}\n"; |
|---|
| 488 |
print "\tnamespace : $self->{namespace}\n"; |
|---|
| 489 |
|
|---|
| 490 |
print "\tDerived : \n"; |
|---|
| 491 |
print "\t hasFields : $self->{hasFields}\n"; |
|---|
| 492 |
print "\t Library : $self->{Library}\n"; |
|---|
| 493 |
print "\t CLASSNAME : $self->{CLASSNAME}\n"; |
|---|
| 494 |
print "\t Classname : $self->{Classname}\n"; |
|---|
| 495 |
print "\t Parent : $self->{Parent}\n"; |
|---|
| 496 |
print "\t Libname : $self->{Libname}\n"; |
|---|
| 497 |
print "\t LIBNAME : $self->{LIBNAME}\n"; |
|---|
| 498 |
print "\t isDecoratable : $self->{isDecoratable}\n"; |
|---|
| 499 |
print "\t Abstract : $self->{Abstract}\n"; |
|---|
| 500 |
print "\t HeaderPrefix : $self->{HeaderPrefix}\n"; |
|---|
| 501 |
print "\t ParentHeaderPrefix : $self->{ParentHeaderPrefix}\n"; |
|---|
| 502 |
print "\t hasPrivateFields : $self->{hasPrivateFields}\n"; |
|---|
| 503 |
print "\t hasProtectedFields : $self->{hasProtectedFields}\n"; |
|---|
| 504 |
print "\t hasPublicFields : $self->{hasPublicFields}\n"; |
|---|
| 505 |
print "\t hasPtrFields : $self->{hasPtrFields}\n"; |
|---|
| 506 |
print "\t Pointerfield : $self->{Pointerfield}\n"; |
|---|
| 507 |
print "\t SFPointerfield : $self->{SFPointerfield}\n"; |
|---|
| 508 |
print "\t MFPointerfield : $self->{MFPointerfield}\n"; |
|---|
| 509 |
print "\t Description : $self->{Description}\n"; |
|---|
| 510 |
print "\t SystemComponent : $self->{SystemComponent}\n"; |
|---|
| 511 |
print "\t FieldMethodType : $self->{FieldMethodType}\n"; |
|---|
| 512 |
print "\t Group : $self->{Group}\n"; |
|---|
| 513 |
print "\t Namespace : $self->{Namespace}\n"; |
|---|
| 514 |
|
|---|
| 515 |
my $fArrayRef = $self->{fields}; |
|---|
| 516 |
|
|---|
| 517 |
for my $field (@$fArrayRef) |
|---|
| 518 |
{ |
|---|
| 519 |
$field->dumpValues(); |
|---|
| 520 |
} |
|---|
| 521 |
|
|---|
| 522 |
} |
|---|
| 523 |
|
|---|
| 524 |
|
|---|
| 525 |
package OSGField; |
|---|
| 526 |
use strict; |
|---|
| 527 |
|
|---|
| 528 |
%OSGField::isPerFieldIf = (); |
|---|
| 529 |
|
|---|
| 530 |
$OSGField::isPerFieldIf{'FieldNamespace'} = "true"; |
|---|
| 531 |
$OSGField::isPerFieldIf{'isPrivate'} = "true"; |
|---|
| 532 |
$OSGField::isPerFieldIf{'isProtected'} = "true"; |
|---|
| 533 |
$OSGField::isPerFieldIf{'isPublic'} = "true"; |
|---|
| 534 |
$OSGField::isPerFieldIf{'hasDefaultHeader'} = "true"; |
|---|
| 535 |
$OSGField::isPerFieldIf{'isMField'} = "true"; |
|---|
| 536 |
$OSGField::isPerFieldIf{'isSField'} = "true"; |
|---|
| 537 |
$OSGField::isPerFieldIf{'isPtrField'} = "true"; |
|---|
| 538 |
$OSGField::isPerFieldIf{'checkNilPtr'} = "true"; |
|---|
| 539 |
$OSGField::isPerFieldIf{'linkSParent'} = "true"; |
|---|
| 540 |
$OSGField::isPerFieldIf{'linkMParent'} = "true"; |
|---|
| 541 |
$OSGField::isPerFieldIf{'doRefCount'} = "true"; |
|---|
| 542 |
$OSGField::isPerFieldIf{'passFieldMask'} = "true"; |
|---|
| 543 |
$OSGField::isPerFieldIf{'removeToSet'} = "true"; |
|---|
| 544 |
$OSGField::isPerFieldIf{'clearMField'} = "true"; |
|---|
| 545 |
$OSGField::isPerFieldIf{'writePushToField'} = "true"; |
|---|
| 546 |
$OSGField::isPerFieldIf{'writeInsertIntoMField'} = "true"; |
|---|
| 547 |
$OSGField::isPerFieldIf{'writeReplaceInMFieldIndex'} = "true"; |
|---|
| 548 |
$OSGField::isPerFieldIf{'writeReplaceInMFieldObject'} = "true"; |
|---|
| 549 |
$OSGField::isPerFieldIf{'writeRemoveFromMFieldIndex'} = "true"; |
|---|
| 550 |
$OSGField::isPerFieldIf{'writeRemoveFromMFieldObject'} = "true"; |
|---|
| 551 |
$OSGField::isPerFieldIf{'writeClearField'} = "true"; |
|---|
| 552 |
$OSGField::isPerFieldIf{'needClassInclude'} = "true"; |
|---|
| 553 |
|
|---|
| 554 |
sub new |
|---|
| 555 |
{ |
|---|
| 556 |
my $class = shift; |
|---|
| 557 |
my $self = {}; |
|---|
| 558 |
|
|---|
| 559 |
$self->{name} = "<UNDEF>"; |
|---|
| 560 |
$self->{type} = "<UNDEF>"; |
|---|
| 561 |
$self->{cardinality} = "<UNDEF>"; |
|---|
| 562 |
$self->{FieldNamespace} = ""; |
|---|
| 563 |
$self->{visibility} = "external"; |
|---|
| 564 |
$self->{fieldFlags} = ""; |
|---|
| 565 |
|
|---|
| 566 |
$self->{defaultValue} = ""; |
|---|
| 567 |
$self->{access} = "public"; |
|---|
| 568 |
$self->{defaultHeader} = ""; |
|---|
| 569 |
$self->{header} = "auto"; |
|---|
| 570 |
$self->{description} = ""; |
|---|
| 571 |
|
|---|
| 572 |
$self->{checkNilPtr} = "true"; |
|---|
| 573 |
$self->{linkSParent} = "false"; |
|---|
| 574 |
$self->{linkMParent} = "false"; |
|---|
| 575 |
$self->{doRefCount} = "true"; |
|---|
| 576 |
$self->{passFieldMask} = "false"; |
|---|
| 577 |
|
|---|
| 578 |
$self->{removeTo} = ""; |
|---|
| 579 |
$self->{removeToSet} = "false"; |
|---|
| 580 |
$self->{clearMField} = "true"; |
|---|
| 581 |
|
|---|
| 582 |
$self->{pushToField} = ""; |
|---|
| 583 |
$self->{insertIntoMField} = ""; |
|---|
| 584 |
$self->{replaceInMFieldIndex} = ""; |
|---|
| 585 |
$self->{replaceInMFieldObject} = ""; |
|---|
| 586 |
$self->{removeFromMFieldIndex} = ""; |
|---|
| 587 |
$self->{removeFromMFieldObject} = ""; |
|---|
| 588 |
$self->{clearField} = ""; |
|---|
| 589 |
|
|---|
| 590 |
$self->{pushToFieldAs} = ""; |
|---|
| 591 |
$self->{insertIntoMFieldAs} = ""; |
|---|
| 592 |
$self->{replaceInMFieldIndexAs} = ""; |
|---|
| 593 |
$self->{replaceInMFieldObjectAs} = ""; |
|---|
| 594 |
$self->{removeFromMFieldIndexAs} = ""; |
|---|
| 595 |
$self->{removeFromMFieldObjectAs} = ""; |
|---|
| 596 |
$self->{clearFieldAs} = ""; |
|---|
| 597 |
|
|---|
| 598 |
$self->{needClassInclude} = "true"; |
|---|
| 599 |
|
|---|
| 600 |
bless $self, $class |
|---|
| 601 |
} |
|---|
| 602 |
|
|---|
| 603 |
sub isPrivate |
|---|
| 604 |
{ |
|---|
| 605 |
my $self = shift; |
|---|
| 606 |
|
|---|
| 607 |
return $self->{isPrivate}; |
|---|
| 608 |
} |
|---|
| 609 |
|
|---|
| 610 |
sub isProtected |
|---|
| 611 |
{ |
|---|
| 612 |
my $self = shift; |
|---|
| 613 |
|
|---|
| 614 |
return $self->{isProtected}; |
|---|
| 615 |
} |
|---|
| 616 |
|
|---|
| 617 |
sub isPublic |
|---|
| 618 |
{ |
|---|
| 619 |
my $self = shift; |
|---|
| 620 |
|
|---|
| 621 |
return $self->{isPublic}; |
|---|
| 622 |
} |
|---|
| 623 |
|
|---|
| 624 |
sub isSField |
|---|
| 625 |
{ |
|---|
| 626 |
my $self = shift; |
|---|
| 627 |
|
|---|
| 628 |
return $self->{isSField}; |
|---|
| 629 |
} |
|---|
| 630 |
|
|---|
| 631 |
sub isMField |
|---|
| 632 |
{ |
|---|
| 633 |
my $self = shift; |
|---|
| 634 |
|
|---|
| 635 |
return $self->{isMField}; |
|---|
| 636 |
} |
|---|
| 637 |
|
|---|
| 638 |
sub isPtrField |
|---|
| 639 |
{ |
|---|
| 640 |
my $self = shift; |
|---|
| 641 |
|
|---|
| 642 |
return $self->{isPtrField}; |
|---|
| 643 |
} |
|---|
| 644 |
|
|---|
| 645 |
sub dumpValues |
|---|
| 646 |
{ |
|---|
| 647 |
my $self = shift; |
|---|
| 648 |
|
|---|
| 649 |
print "\n\tField\n"; |
|---|
| 650 |
print "\t\tname : $self->{name}\n"; |
|---|
| 651 |
print "\t\ttype : $self->{type}\n"; |
|---|
| 652 |
print "\t\tcardinality : $self->{cardinality}\n"; |
|---|
| 653 |
print "\t\tvisibility : $self->{visibility}\n"; |
|---|
| 654 |
print "\t\tdefaultValue : $self->{defaultValue}\n"; |
|---|
| 655 |
print "\t\taccess : $self->{access}\n"; |
|---|
| 656 |
print "\t\tdefaultHeader : $self->{defaultHeader}\n"; |
|---|
| 657 |
print "\t\theader : $self->{header}\n"; |
|---|
| 658 |
print "\t\tcheckNilPtr : $self->{checkNilPtr}\n"; |
|---|
| 659 |
print "\t\tlinkSParent : $self->{linkSParent}\n"; |
|---|
| 660 |
print "\t\tlinkMParent : $self->{linkMParent}\n"; |
|---|
| 661 |
print "\t\tdoRefCount : $self->{doRefCount}\n"; |
|---|
| 662 |
print "\t\tpassFieldMask : $self->{passFieldMask}\n"; |
|---|
| 663 |
print "\t\tremoveTo : $self->{removeTo}\n"; |
|---|
| 664 |
print "\t\tremoveToSet : $self->{removeToSet}\n"; |
|---|
| 665 |
print "\t\tclearMField : $self->{clearMField}\n"; |
|---|
| 666 |
print "\t\tpushToField : $self->{pushToField}\n"; |
|---|
| 667 |
print "\t\tinsertIntoMField : $self->{insertIntoMField}\n"; |
|---|
| 668 |
print "\t\treplaceInMFieldIndex : $self->{replaceInMFieldIndex}\n"; |
|---|
| 669 |
print "\t\treplaceInMFieldObject : $self->{replaceInMFieldObject}\n"; |
|---|
| 670 |
print "\t\tremoveFromMFieldIndex : $self->{removeFromMFieldIndex}\n"; |
|---|
| 671 |
print "\t\tremoveFromMFieldObject : $self->{removeFromMFieldObject}\n"; |
|---|
| 672 |
print "\t\tclearField : $self->{clearField}\n"; |
|---|
| 673 |
print "\t\tpushToFieldAs : $self->{pushToFieldAs}\n"; |
|---|
| 674 |
print "\t\tinsertIntoMFieldAs : $self->{insertIntoMFieldAs}\n"; |
|---|
| 675 |
print "\t\treplaceInMFieldIndexAs : $self->{replaceInMFieldIndexAs}\n"; |
|---|
| 676 |
print "\t\treplaceInMFieldObjectAs : $self->{replaceInMFieldObjectAs}\n"; |
|---|
| 677 |
print "\t\tremoveFromMFieldIndexAs : $self->{removeFromMFieldIndexAs}\n"; |
|---|
| 678 |
print "\t\tremoveFromMFieldObjectAs : $self->{removeFromMFieldObjectAs}\n"; |
|---|
| 679 |
print "\t\tclearFieldAs : $self->{clearFieldAs}\n"; |
|---|
| 680 |
|
|---|
| 681 |
print "\n\t\tDerived :\n"; |
|---|
| 682 |
print "\t\t\tFieldname : $self->{Fieldname}\n"; |
|---|
| 683 |
print "\t\t\tFieldtype : $self->{Fieldtype}\n"; |
|---|
| 684 |
print "\t\t\tFieldtypeCapsClean : $self->{FieldtypeCapsClean}\n"; |
|---|
| 685 |
print "\t\t\tCapsFieldtypeClean : $self->{CapsFieldtypeClean}\n"; |
|---|
| 686 |
print "\t\t\tisPrivate : $self->{isPrivate}\n"; |
|---|
| 687 |
print "\t\t\tisProtected : $self->{isProtected}\n"; |
|---|
| 688 |
print "\t\t\tisPublic : $self->{isPublic}\n"; |
|---|
| 689 |
print "\t\t\tCARDINALITY : $self->{CARDINALITY}\n"; |
|---|
| 690 |
print "\t\t\tFieldMethodType : $self->{FieldMethodType}\n"; |
|---|
| 691 |
print "\t\t\tfieldname : $self->{fieldname}\n"; |
|---|
| 692 |
print "\t\t\tFieldSeparator : $self->{FieldSeparator}\n"; |
|---|
| 693 |
print "\t\t\thasDefaultHeader : $self->{hasDefaultHeader}\n"; |
|---|
| 694 |
print "\t\t\tfieldnameDesc : $self->{fieldnameDesc}\n"; |
|---|
| 695 |
print "\t\t\tfieldvisibility : $self->{fieldvisibility}\n"; |
|---|
| 696 |
print "\t\t\tFielddescription : $self->{Fielddescription}\n"; |
|---|
| 697 |
print "\t\t\tisSField : $self->{isSField}\n"; |
|---|
| 698 |
print "\t\t\tisMField : $self->{isMField}\n"; |
|---|
| 699 |
print "\t\t\tisPtrField : $self->{isPtrField}\n"; |
|---|
| 700 |
print "\t\t\tpushToField : $self->{pushToField}\n"; |
|---|
| 701 |
print "\t\t\twriteInsertIntoMField : $self->{insertIntoMField}\n"; |
|---|
| 702 |
print "\t\t\twriteReplaceInMFieldIndex : $self->{replaceInMFieldIndex}\n"; |
|---|
| 703 |
print "\t\t\twritePeplaceInMFieldObject : $self->{replaceInMFieldObject}\n"; |
|---|
| 704 |
print "\t\t\twriteRemoveFromMFieldIndex : $self->{removeFromMFieldIndex}\n"; |
|---|
| 705 |
print "\t\t\twriteRemoveFromMFieldObject : $self->{removeFromMFieldObject}\n"; |
|---|
| 706 |
print "\t\t\twriteClearField : $self->{clearField}\n"; |
|---|
| 707 |
} |
|---|
| 708 |
|
|---|
| 709 |
sub finalize |
|---|
| 710 |
{ |
|---|
| 711 |
my $self = shift; |
|---|
| 712 |
my $fc = shift; |
|---|
| 713 |
|
|---|
| 714 |
my $cleanType; |
|---|
| 715 |
|
|---|
| 716 |
$cleanType = $self->{type}; |
|---|
| 717 |
|
|---|
| 718 |
$cleanType =~ s/^std:://; |
|---|
| 719 |
|
|---|
| 720 |
$self->{Fieldname} = ucfirst($self->{name}); |
|---|
| 721 |
$self->{Fieldtype} = $self->{type}; |
|---|
| 722 |
$self->{FieldtypeCapsClean} = ucfirst($cleanType); |
|---|
| 723 |
$self->{CapsFieldtypeClean} = ucfirst($cleanType); |
|---|
| 724 |
|
|---|
| 725 |
$self->{isPrivate} = "false"; |
|---|
| 726 |
$self->{isProtected} = "false"; |
|---|
| 727 |
$self->{isPublic} = "false"; |
|---|
| 728 |
|
|---|
| 729 |
if($self->{access} eq "private") |
|---|
| 730 |
{ |
|---|
| 731 |
$self->{isPrivate} = "true"; |
|---|
| 732 |
} |
|---|
| 733 |
elsif($self->{access} eq "protected") |
|---|
| 734 |
{ |
|---|
| 735 |
$self->{isProtected} = "true"; |
|---|
| 736 |
} |
|---|
| 737 |
elsif($self->{access} eq "public") |
|---|
| 738 |
{ |
|---|
| 739 |
$self->{isPublic} = "true"; |
|---|
| 740 |
} |
|---|
| 741 |
|
|---|
| 742 |
$self->{isMField} = "false"; |
|---|
| 743 |
$self->{isSField} = "false"; |
|---|
| 744 |
|
|---|
| 745 |
if($self->{cardinality} eq "single") |
|---|
| 746 |
{ |
|---|
| 747 |
$self->{isSField} = "true"; |
|---|
| 748 |
} |
|---|
| 749 |
|
|---|
| 750 |
if($self->{cardinality} eq "multi") |
|---|
| 751 |
{ |
|---|
| 752 |
$self->{isMField} = "true"; |
|---|
| 753 |
} |
|---|
| 754 |
|
|---|
| 755 |
if($self->{header} eq "" || $self->{header} eq "auto") |
|---|
| 756 |
{ |
|---|
| 757 |
if($fc->isSystemComponent() eq "true") |
|---|
| 758 |
{ |
|---|
| 759 |
$self->{FieldtypeInclude} = "OSG" |
|---|
| 760 |
} |
|---|
| 761 |
else |
|---|
| 762 |
{ |
|---|
| 763 |
$self->{FieldtypeInclude} = "OpenSG/OSG" |
|---|
| 764 |
} |
|---|
| 765 |
|
|---|
| 766 |
$self->{FieldtypeInclude} .= $self->{FieldtypeCapsClean}; |
|---|
| 767 |
$self->{FieldtypeInclude} =~ s/Ptr$//; |
|---|
| 768 |
$self->{FieldtypeInclude} =~ s/GLP:://; |
|---|
| 769 |
$self->{FieldtypeInclude} .= "Fields.h"; |
|---|
| 770 |
} |
|---|
| 771 |
else |
|---|
| 772 |
{ |
|---|
| 773 |
$self->{FieldtypeInclude} = $self->{header}; |
|---|
| 774 |
} |
|---|
| 775 |
|
|---|
| 776 |
$self->{fieldname} = ""; |
|---|
| 777 |
|
|---|
| 778 |
if($self->isSField() eq "true") |
|---|
| 779 |
{ |
|---|
| 780 |
$self->{CARDINALITY} = "SF"; |
|---|
| 781 |
$self->{fieldname} = "sf"; |
|---|
| 782 |
} |
|---|
| 783 |
|
|---|
| 784 |
if($self->isMField() eq "true") |
|---|
| 785 |
{ |
|---|
| 786 |
$self->{CARDINALITY} = "MF"; |
|---|
| 787 |
$self->{fieldname} = "mf"; |
|---|
| 788 |
} |
|---|
| 789 |
|
|---|
| 790 |
if($self->{CapsFieldtypeClean} =~ m/([A-Za-z_]*)::/) |
|---|
| 791 |
{ |
|---|
| 792 |
$self->{FieldNamespace} = "$1::"; |
|---|
| 793 |
$self->{CapsFieldtypeClean} =~ s/$1:://; |
|---|
| 794 |
} |
|---|
| 795 |
|
|---|
| 796 |
$self->{fieldname} .= $self->{Fieldname}; |
|---|
| 797 |
|
|---|
| 798 |
$self->{FieldMethodType} = ""; |
|---|
| 799 |
|
|---|
| 800 |
if($fc->isDecoratable() eq "true") |
|---|
| 801 |
{ |
|---|
| 802 |
$self->{FieldMethodType} = "virtual"; |
|---|
| 803 |
} |
|---|
| 804 |
|
|---|
| 805 |
$self->{FieldSeparator} = ","; |
|---|
| 806 |
|
|---|
| 807 |
if(exists $self->{defaultHeader} && $self->{defaultHeader} ne "") |
|---|
| 808 |
{ |
|---|
| 809 |
$self->{hasDefaultHeader} = "true"; |
|---|
| 810 |
|
|---|
| 811 |
if(! ($self->{defaultHeader} =~ m/\"|</)) |
|---|
| 812 |
{ |
|---|
| 813 |
$self->{defaultHeader} = '"'.$self->{defaultHeader}.'"'; |
|---|
| 814 |
} |
|---|
| 815 |
} |
|---|
| 816 |
else |
|---|
| 817 |
{ |
|---|
| 818 |
$self->{hasDefaultHeader} = "false"; |
|---|
| 819 |
} |
|---|
| 820 |
|
|---|
| 821 |
if(exists $self->{defaultValue} && $self->{defaultValue} ne "") |
|---|
| 822 |
{ |
|---|
| 823 |
$self->{FieldTypedDefault} = $self->{type}; |
|---|
| 824 |
|
|---|
| 825 |
$self->{FieldTypedDefault} .= "("; |
|---|
| 826 |
|
|---|
| 827 |
if($self->{type} =~ m/std::string/) |
|---|
| 828 |
{ |
|---|
| 829 |
$self->{FieldTypedDefault} .= "\""; |
|---|
| 830 |
} |
|---|
| 831 |
|
|---|
| 832 |
$self->{FieldTypedDefault} .= $self->{defaultValue}; |
|---|
| 833 |
|
|---|
| 834 |
if($self->{type} =~ m/std::string/) |
|---|
| 835 |
{ |
|---|
| 836 |
$self->{FieldTypedDefault} .= "\""; |
|---|
| 837 |
} |
|---|
| 838 |
|
|---|
| 839 |
$self->{FieldTypedDefault} .= ")"; |
|---|
| 840 |
} |
|---|
| 841 |
else |
|---|
| 842 |
{ |
|---|
| 843 |
$self->{FieldTypedDefault} = ""; |
|---|
| 844 |
} |
|---|
| 845 |
|
|---|
| 846 |
$self->{fieldnameDesc} = $self->{name}; |
|---|
| 847 |
|
|---|
| 848 |
if($self->{visibility} eq "external") |
|---|
| 849 |
{ |
|---|
| 850 |
$self->{fieldvisibility} = "false"; |
|---|
| 851 |
} |
|---|
| 852 |
|
|---|
| 853 |
if($self->{visibility} eq "internal") |
|---|
| 854 |
{ |
|---|
| 855 |
$self->{fieldvisibility} = "true"; |
|---|
| 856 |
} |
|---|
| 857 |
|
|---|
| 858 |
|
|---|