Compare commits
1572
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
fe2fb8e6ae | ||
|
|
4793166abf | ||
|
|
4494eb061e | ||
|
|
8ed9e01c63 | ||
|
|
55fc86741b | ||
|
|
9c0cafb82c | ||
|
|
ede50bec49 | ||
|
|
feb0b83365 | ||
|
|
d4f5a35e87 | ||
|
|
da707f3e40 | ||
|
|
59a6fd1ed8 | ||
|
|
8c8d9e5cc4 | ||
|
|
d36170879c | ||
|
|
204e483c08 | ||
|
|
f582eb5310 | ||
|
|
6f9a14d6c4 | ||
|
|
76fcad0a0b | ||
|
|
cc06799838 | ||
|
|
8a26c382a2 | ||
|
|
22198d8bd2 | ||
|
|
d534dcadfb | ||
|
|
708ae35068 | ||
|
|
50cea4f64e | ||
|
|
c782a32076 | ||
|
|
edc877442f | ||
|
|
a1fe0f6305 | ||
|
|
cb5aee9fa4 | ||
|
|
9b18b14f11 | ||
|
|
0fd7bb8d3f | ||
|
|
c836018ac7 | ||
|
|
ba678eabdc | ||
|
|
9442d3d0f3 | ||
|
|
9f0313dd0b | ||
|
|
3d109f9c4c | ||
|
|
f8a337fb9f | ||
|
|
3c0966279c | ||
|
|
c033979130 | ||
|
|
c828961327 | ||
|
|
83a95a0488 | ||
|
|
f3c131ffaf | ||
|
|
b06e38699a | ||
|
|
3a07e2fe21 | ||
|
|
ca668f8a37 | ||
|
|
5181aecc7b | ||
|
|
0e92cfbd0d | ||
|
|
60c7507a33 | ||
|
|
c7c3fae5c2 | ||
|
|
4acbb2a312 | ||
|
|
4e6159aa07 | ||
|
|
6a1d05646c | ||
|
|
2e05043f43 | ||
|
|
1b8216e911 | ||
|
|
a2121b86df | ||
|
|
1cd17e9edd | ||
|
|
5229f5a13c | ||
|
|
4ff014d275 | ||
|
|
83243f471a | ||
|
|
3c0c51a946 | ||
|
|
08ad449774 | ||
|
|
eae1b99036 | ||
|
|
44f27b23d0 | ||
|
|
92c83bc280 | ||
|
|
10bbd435b7 | ||
|
|
2ef8672a6b | ||
|
|
a22dd264cd | ||
|
|
baf5116841 | ||
|
|
e55017bbfc | ||
|
|
19636bda4e | ||
|
|
83124e0c05 | ||
|
|
a079870bca | ||
|
|
ce71b8c1cf | ||
|
|
7b0c25f91e | ||
|
|
feab25d0be | ||
|
|
956b4406d0 | ||
|
|
3a0fbae4d9 | ||
|
|
f106dc2a29 | ||
|
|
252a539e69 | ||
|
|
df6badfdd5 | ||
|
|
7479ae521c | ||
|
|
416fb94ae8 | ||
|
|
3a620fe55d | ||
|
|
5208750cdb | ||
|
|
c684f8f043 | ||
|
|
73084863b7 | ||
|
|
503310cdb8 | ||
|
|
bda8d34c2b | ||
|
|
2ee87483f9 | ||
|
|
9e04bf1ece | ||
|
|
29c8c9f989 | ||
|
|
1035e714ff | ||
|
|
57fa022c9f | ||
|
|
76c3f7bc8f | ||
|
|
6d2646239e | ||
|
|
c955e61ba7 | ||
|
|
c31a5279af | ||
|
|
840780dc4a | ||
|
|
02b3c37b9f | ||
|
|
d14fe813a9 | ||
|
|
44ff23b227 | ||
|
|
257459abc6 | ||
|
|
e988dc0e42 | ||
|
|
7d544dee47 | ||
|
|
1670f88e54 | ||
|
|
58c7edfed6 | ||
|
|
122d7f681f | ||
|
|
acec1ba4bf | ||
|
|
0040757cd3 | ||
|
|
49d554e9d8 | ||
|
|
fa3389ed23 | ||
|
|
188a84a893 | ||
|
|
ceff1622c1 | ||
|
|
8d15cacf92 | ||
|
|
80161bfa96 | ||
|
|
c32ab1b84f | ||
|
|
73c0ce628b | ||
|
|
dc68397e48 | ||
|
|
c934b47f2e | ||
|
|
07d3d6508a | ||
|
|
e4a8896fdc | ||
|
|
33e1a9457a | ||
|
|
b6a20fd6e4 | ||
|
|
ae9757bf43 | ||
|
|
b9a34b1b05 | ||
|
|
c33f66b691 | ||
|
|
cf8d6c2621 | ||
|
|
6c789f7165 | ||
|
|
7d77eff4f4 | ||
|
|
f83278bd61 | ||
|
|
9a96018cc2 | ||
|
|
ab3612517f | ||
|
|
0909722bb5 | ||
|
|
1cb8f9237c | ||
|
|
4cac366468 | ||
|
|
a6138b3445 | ||
|
|
093e4614d3 | ||
|
|
82efb8a784 | ||
|
|
be720709fe | ||
|
|
325b13b101 | ||
|
|
203d1c2b45 | ||
|
|
c3c97f2956 | ||
|
|
ac535de2fa | ||
|
|
9d4f0f5824 | ||
|
|
b4f5eaa541 | ||
|
|
66cdbf6215 | ||
|
|
c9e0bfb7fe | ||
|
|
6da8ef83af | ||
|
|
f53559b8d0 | ||
|
|
49f038b9d1 | ||
|
|
ce67657e0a | ||
|
|
56c520f455 | ||
|
|
9f88b077ee | ||
|
|
50315a7346 | ||
|
|
6b58afe823 | ||
|
|
167cba9e93 | ||
|
|
ce89a410d2 | ||
|
|
98d0f33f8f | ||
|
|
c305341ef4 | ||
|
|
0607a67a92 | ||
|
|
5f2f95676c | ||
|
|
4bf16243fc | ||
|
|
607738f22e | ||
|
|
200df49d6e | ||
|
|
580a1b7fc2 | ||
|
|
3372f9fc0d | ||
|
|
4787ac64ff | ||
|
|
fef625ce27 | ||
|
|
0b53dd8fa7 | ||
|
|
fe628e44e1 | ||
|
|
d314b6a552 | ||
|
|
02462d1752 | ||
|
|
5b734d8c52 | ||
|
|
81d640ed7c | ||
|
|
7e2ad05fae | ||
|
|
bda5890f17 | ||
|
|
c7dd293e01 | ||
|
|
fbf0a20f38 | ||
|
|
87ccfbab02 | ||
|
|
97f39282ef | ||
|
|
4fd3d49fc1 | ||
|
|
a70c8a9cae | ||
|
|
c0926633e8 | ||
|
|
1ae91097ba | ||
|
|
bfd76880a9 | ||
|
|
662578dbe7 | ||
|
|
48c6d3d89a | ||
|
|
7bdb530440 | ||
|
|
bfe953c18d | ||
|
|
136676012f | ||
|
|
0994ffc195 | ||
|
|
df19feac34 | ||
|
|
961fa89b7a | ||
|
|
ddf9e08069 | ||
|
|
b5f3978b8a | ||
|
|
82dc6c32ec | ||
|
|
889e2d6f06 | ||
|
|
9a28642a4e | ||
|
|
0b953462f7 | ||
|
|
061eb686c6 | ||
|
|
937297561f | ||
|
|
bf70d6f087 | ||
|
|
26fdfc42f4 | ||
|
|
abab8c6ec8 | ||
|
|
a7697f6095 | ||
|
|
49270e99e5 | ||
|
|
d75ce1e12e | ||
|
|
289e768ca5 | ||
|
|
44c587400d | ||
|
|
df467b9dba | ||
|
|
510543e14b | ||
|
|
c3133f020d | ||
|
|
a7439aa056 | ||
|
|
d7bea0c4c6 | ||
|
|
764a3c29e9 | ||
|
|
3c57572b89 | ||
|
|
fe7c6554f7 | ||
|
|
19bb7f5a83 | ||
|
|
c0e20ad56b | ||
|
|
49887ff06e | ||
|
|
1f6555c9ad | ||
|
|
7f8efa7cef | ||
|
|
8106956be2 | ||
|
|
cc435ba817 | ||
|
|
0c55a4d7bb | ||
|
|
c4b4c0ce59 | ||
|
|
d31c1df639 | ||
|
|
780286ea81 | ||
|
|
20a75b9c9e | ||
|
|
2a2e2716bd | ||
|
|
6a07c22826 | ||
|
|
7c294915c8 | ||
|
|
7788cb288e | ||
|
|
c1762c709e | ||
|
|
8690528080 | ||
|
|
5376294389 | ||
|
|
fa1b703bf8 | ||
|
|
72d2c7f078 | ||
|
|
09ecc66e53 | ||
|
|
879dc295a8 | ||
|
|
8a5a1d3301 | ||
|
|
67c8067aed | ||
|
|
123e32e345 | ||
|
|
3a09d67f59 | ||
|
|
ec3ed8fbcd | ||
|
|
18370ebd08 | ||
|
|
acbc09b232 | ||
|
|
9d1cf253b4 | ||
|
|
e46304d1ce | ||
|
|
668c62b1f4 | ||
|
|
49f418f146 | ||
|
|
c46c735f2f | ||
|
|
82aa7fcbad | ||
|
|
2cfeeb4b13 | ||
|
|
aa859c488f | ||
|
|
1b2915aa2a | ||
|
|
e99c3d4705 | ||
|
|
d23491646a | ||
|
|
1d740a63bd | ||
|
|
d1897fabf0 | ||
|
|
d4178d6440 | ||
|
|
f4d42289d4 | ||
|
|
d0def466da | ||
|
|
959f44502b | ||
|
|
1840541f6d | ||
|
|
c5ec6927b3 | ||
|
|
7beaf3705e | ||
|
|
792ffa2d26 | ||
|
|
bbd61977f1 | ||
|
|
e3d1fa2686 | ||
|
|
293d3b4fb3 | ||
|
|
e1d8155565 | ||
|
|
c37b27a926 | ||
|
|
6b3a05e23f | ||
|
|
0e92bb58b0 | ||
|
|
63cbd4deb0 | ||
|
|
17bcd4e2ab | ||
|
|
72f301c655 | ||
|
|
a62a8518b9 | ||
|
|
fa169d6aa2 | ||
|
|
d2bcb86e1e | ||
|
|
ed7361622b | ||
|
|
3117ec5a7d | ||
|
|
cb4716f403 | ||
|
|
b48c0e968f | ||
|
|
aa2ed5fb0c | ||
|
|
8b7a279c61 | ||
|
|
b286e9d337 | ||
|
|
d671c3d9fa | ||
|
|
7086f2dc89 | ||
|
|
7e8bb9ea00 | ||
|
|
4e46bb6671 | ||
|
|
de35658096 | ||
|
|
034f5db3bd | ||
|
|
57375bfd73 | ||
|
|
b846e33ee3 | ||
|
|
cc9b817f0e | ||
|
|
0d419aba8a | ||
|
|
ae22321d9c | ||
|
|
87169febf8 | ||
|
|
dd044844e5 | ||
|
|
0c8c596ee5 | ||
|
|
b9496fef1d | ||
|
|
b4b9d3a4b7 | ||
|
|
0128c89f8d | ||
|
|
9e77d06c72 | ||
|
|
25bb1cc957 | ||
|
|
2c6f8299f0 | ||
|
|
6a2773c3ac | ||
|
|
1eea917121 | ||
|
|
ea1bbbabfa | ||
|
|
399d2bc73c | ||
|
|
0759dbcdc9 | ||
|
|
1ae0f9c19d | ||
|
|
e8364a03bc | ||
|
|
046d88ab2d | ||
|
|
f161f78a33 | ||
|
|
1912444886 | ||
|
|
b6ef5a0a3d | ||
|
|
401c88adbb | ||
|
|
42984d1bfb | ||
|
|
6997082b03 | ||
|
|
139217dc79 | ||
|
|
2cc2a857a2 | ||
|
|
7dfb463ba9 | ||
|
|
da07871bc6 | ||
|
|
530d2309e7 | ||
|
|
7e7a5d38f8 | ||
|
|
ecf949dee0 | ||
|
|
9b0ba10b0b | ||
|
|
9f9c4cf32c | ||
|
|
536ebf604f | ||
|
|
03a616b737 | ||
|
|
0b05f67114 | ||
|
|
0ede690580 | ||
|
|
d81545a871 | ||
|
|
1cda1fc201 | ||
|
|
490dad7838 | ||
|
|
13ecbb8bce | ||
|
|
3346bfc9a8 | ||
|
|
c5de65f115 | ||
|
|
4fffcf9975 | ||
|
|
8962d9b293 | ||
|
|
050c1560e8 | ||
|
|
68b3041f50 | ||
|
|
1ddd153399 | ||
|
|
df0a60caae | ||
|
|
675c86582d | ||
|
|
e6d01ed1a3 | ||
|
|
d8d1064e05 | ||
|
|
5d04cb81ba | ||
|
|
5d5906e980 | ||
|
|
2e7b862ad3 | ||
|
|
ad86e22824 | ||
|
|
536b8a213b | ||
|
|
2e13877926 | ||
|
|
967d63dec4 | ||
|
|
573c4268b6 | ||
|
|
f19e83dcf1 | ||
|
|
caabe8fc87 | ||
|
|
7c4e5309fc | ||
|
|
542124e90c | ||
|
|
e0d02be0f5 | ||
|
|
461e6d1b5b | ||
|
|
d767e6d7eb | ||
|
|
bff1584012 | ||
|
|
3d91a11b95 | ||
|
|
1349b46a8c | ||
|
|
74330ba1dd | ||
|
|
64ab227f62 | ||
|
|
1c51fbd1b4 | ||
|
|
4c2dd553f2 | ||
|
|
2fb985afa4 | ||
|
|
44c93d5074 | ||
|
|
dcf07a46aa | ||
|
|
284a9e0612 | ||
|
|
60349a8690 | ||
|
|
64072be83c | ||
|
|
229abb8412 | ||
|
|
7b1d1fd288 | ||
|
|
1ca1f6ad22 | ||
|
|
0ad66f4bc4 | ||
|
|
d5757c4fb8 | ||
|
|
7fe40bce86 | ||
|
|
5da3d64ede | ||
|
|
2e93b06ac0 | ||
|
|
1e6aa4b40f | ||
|
|
262383395d | ||
|
|
127226c421 | ||
|
|
fabcb021cb | ||
|
|
60ab1ab83e | ||
|
|
1f37095087 | ||
|
|
93c2f70b64 | ||
|
|
b0562df6bb | ||
|
|
65d6a5c774 | ||
|
|
650af0f7b0 | ||
|
|
cf9de25c25 | ||
|
|
fc4009aa50 | ||
|
|
d04cf4d897 | ||
|
|
2e45c67ef2 | ||
|
|
b6d8e1f842 | ||
|
|
284bc364fe | ||
|
|
a050654b4c | ||
|
|
7311dae483 | ||
|
|
c57c3cd1d3 | ||
|
|
3ec5e85485 | ||
|
|
ff95af0367 | ||
|
|
aa9c7d5435 | ||
|
|
dcc9f33357 | ||
|
|
1ace645505 | ||
|
|
dc2b87dce1 | ||
|
|
8e47f5d494 | ||
|
|
333d381f41 | ||
|
|
f9b064cc19 | ||
|
|
116a6c1b2e | ||
|
|
c4506b8e6c | ||
|
|
6786a7be4a | ||
|
|
bb370a304d | ||
|
|
fdcf53c688 | ||
|
|
d3f575547c | ||
|
|
68797e51c6 | ||
|
|
c76c55cdee | ||
|
|
f529ec3018 | ||
|
|
ad667be0d7 | ||
|
|
133fa09261 | ||
|
|
acf19cebf8 | ||
|
|
5dfa4c0840 | ||
|
|
f918602f58 | ||
|
|
2cf2dd24a4 | ||
|
|
eefb069d08 | ||
|
|
3dcffc7df8 | ||
|
|
b121277142 | ||
|
|
d283fcf7b4 | ||
|
|
e7f151ad02 | ||
|
|
0710b781d3 | ||
|
|
7c01ad6917 | ||
|
|
56d2f06631 | ||
|
|
9e47911b19 | ||
|
|
ef80497fbe | ||
|
|
e22cf106c2 | ||
|
|
5ffb270ec1 | ||
|
|
f85f3b0f25 | ||
|
|
e7ec83d626 | ||
|
|
11479cd8c3 | ||
|
|
176e760de1 | ||
|
|
430c60ed1a | ||
|
|
dfea3623f6 | ||
|
|
b38783e4cb | ||
|
|
9382a4c21b | ||
|
|
3cd4c5566f | ||
|
|
601c0977df | ||
|
|
c56f036bab | ||
|
|
44dd50c0ef | ||
|
|
56919ae45f | ||
|
|
6c14e7127d | ||
|
|
578af00b0d | ||
|
|
d6c0bf69b6 | ||
|
|
e8884b4ec0 | ||
|
|
5e79609955 | ||
|
|
4950c96f1c | ||
|
|
51b0cf535e | ||
|
|
4cc17a7f6e | ||
|
|
dca07c5634 | ||
|
|
fd42294faf | ||
|
|
c1246e8c4e | ||
|
|
59fc902cfb | ||
|
|
1fe9755d01 | ||
|
|
1da09a4706 | ||
|
|
f3c591469b | ||
|
|
b1200f9f59 | ||
|
|
47617d6c04 | ||
|
|
4794ab6095 | ||
|
|
bc85767f19 | ||
|
|
e37c218c2a | ||
|
|
a0aaa23904 | ||
|
|
27a6c72091 | ||
|
|
2dcc66f03e | ||
|
|
d70a05a088 | ||
|
|
c2317edf8a | ||
|
|
cb7ac404d9 | ||
|
|
5abc6c995f | ||
|
|
0f21c39e49 | ||
|
|
f6513127ce | ||
|
|
ddd72b2b37 | ||
|
|
7f5df1fb66 | ||
|
|
2e71b64de1 | ||
|
|
45f1f9263f | ||
|
|
878288f06a | ||
|
|
406cdf8d16 | ||
|
|
5b28b024ae | ||
|
|
7c693d8107 | ||
|
|
b8a6d1ac4d | ||
|
|
40533f50df | ||
|
|
539ced191b | ||
|
|
1a400b890b | ||
|
|
ebe5a5579c | ||
|
|
afb18ca75b | ||
|
|
01c62932bd | ||
|
|
6cd8db7b28 | ||
|
|
bb46d91bc6 | ||
|
|
3cd5322496 | ||
|
|
cadecdcab7 | ||
|
|
cd4030b7db | ||
|
|
0a2264cad4 | ||
|
|
bb2a02daa8 | ||
|
|
5991195062 | ||
|
|
54c4055af3 | ||
|
|
cb07210bc7 | ||
|
|
3e40d624a8 | ||
|
|
63ce675914 | ||
|
|
14e5e87a4d | ||
|
|
e7e81c6639 | ||
|
|
23d0601d82 | ||
|
|
6db9138eeb | ||
|
|
6a7c200002 | ||
|
|
e3f70b7125 | ||
|
|
a25e859fa7 | ||
|
|
5b2af1f6b3 | ||
|
|
59df72c4b0 | ||
|
|
4e2eb2f24c | ||
|
|
b905f4b8aa | ||
|
|
fefe87ed1e | ||
|
|
b66905c2f6 | ||
|
|
39472e4d81 | ||
|
|
85fba1325a | ||
|
|
0f39f05fa1 | ||
|
|
8d551c2664 | ||
|
|
346a22f684 | ||
|
|
b1571e4437 | ||
|
|
5ac2abe3ab | ||
|
|
5b15426cc6 | ||
|
|
1ac944b7c1 | ||
|
|
fd90dbb123 | ||
|
|
6ccad91537 | ||
|
|
c89db53ebf | ||
|
|
4ffd70a42a | ||
|
|
bbeb48a60d | ||
|
|
aefe9bc116 | ||
|
|
bcb95f647d | ||
|
|
145a7fa146 | ||
|
|
06f0b6030a | ||
|
|
191ee3a0ed | ||
|
|
f6358694ae | ||
|
|
af14d65a98 | ||
|
|
9fe75dc521 | ||
|
|
0051bea034 | ||
|
|
76c79dba8e | ||
|
|
84dc82506a | ||
|
|
ae1625734c | ||
|
|
e2ce4c0fa9 | ||
|
|
a06a15e769 | ||
|
|
7c5de29b61 | ||
|
|
5f9befebae | ||
|
|
6a7b885891 | ||
|
|
cd8e7bbdca | ||
|
|
5d731ad8c3 | ||
|
|
7964270929 | ||
|
|
ea513d392e | ||
|
|
feba9024eb | ||
|
|
b3e16ce8e0 | ||
|
|
31dd77c694 | ||
|
|
ae58f89fbf | ||
|
|
b3bc36b253 | ||
|
|
7287509fef | ||
|
|
b1c49045a8 | ||
|
|
0d5634475c | ||
|
|
e6bfe7d40c | ||
|
|
811cd0653f | ||
|
|
e2b8a21ff5 | ||
|
|
24c7941f65 | ||
|
|
600a9ee4c5 | ||
|
|
fdfdfedf01 | ||
|
|
a67688322d | ||
|
|
6fe057e277 | ||
|
|
f23e8bfb02 | ||
|
|
eab9da98f2 | ||
|
|
f161992836 | ||
|
|
40e13b91fe | ||
|
|
af6824605b | ||
|
|
babf58f8d2 | ||
|
|
968f5d7693 | ||
|
|
4cc6bd69ae | ||
|
|
199437e859 | ||
|
|
e5fac0a01d | ||
|
|
5d14b84969 | ||
|
|
bcccd06cee | ||
|
|
6b0ab9a49a | ||
|
|
023002ae73 | ||
|
|
579d384c04 | ||
|
|
e2e1524454 | ||
|
|
4a5853c1c2 | ||
|
|
64756d14d0 | ||
|
|
bac2ef601d | ||
|
|
cf3bab89f9 | ||
|
|
dfe41ad984 | ||
|
|
b784bebaa9 | ||
|
|
bcf727cf58 | ||
|
|
ecd0a53412 | ||
|
|
3456434e37 | ||
|
|
454c5b1ed2 | ||
|
|
dc2c437a1a | ||
|
|
819d3f5ded | ||
|
|
4f802689f2 | ||
|
|
9cbbe55598 | ||
|
|
7e2dafdcb8 | ||
|
|
c7873d68f7 | ||
|
|
939ec526a8 | ||
|
|
b20a635db0 | ||
|
|
a656bee0df | ||
|
|
42f07e3f14 | ||
|
|
5803b05bd5 | ||
|
|
ccf0ba50c4 | ||
|
|
f3bc977d32 | ||
|
|
80609e0816 | ||
|
|
795d481ca6 | ||
|
|
1b936b9af8 | ||
|
|
f141cc28b0 | ||
|
|
4cb64b58be | ||
|
|
028af34d3d | ||
|
|
ce54997be5 | ||
|
|
3d213fa713 | ||
|
|
e71f3790ce | ||
|
|
67b9cba4d3 | ||
|
|
78a471f684 | ||
|
|
d4289c5d54 | ||
|
|
0c17c5440a | ||
|
|
c4116da564 | ||
|
|
d0821953bb | ||
|
|
e782adef94 | ||
|
|
d3572c2562 | ||
|
|
1f3838b155 | ||
|
|
6aa459073e | ||
|
|
0932c33185 | ||
|
|
5e542aa841 | ||
|
|
6d53abd5af | ||
|
|
3ea58bf8db | ||
|
|
71a4c2c3d2 | ||
|
|
a3e391a523 | ||
|
|
9cb15b302c | ||
|
|
15c1a28d37 | ||
|
|
d3a500e54e | ||
|
|
a0a5eb8aef | ||
|
|
a92955eade | ||
|
|
f043f3d4f9 | ||
|
|
992a057a1b | ||
|
|
07da1e7e1a | ||
|
|
2c07222ef6 | ||
|
|
918e315d47 | ||
|
|
c824731bc6 | ||
|
|
0c39caa622 | ||
|
|
1f1e28baf8 | ||
|
|
0c303389d6 | ||
|
|
01a896ef5b | ||
|
|
0e5e760135 | ||
|
|
7e7d877874 | ||
|
|
57ccb6fd6b | ||
|
|
efa2876e29 | ||
|
|
59ef7d8fd1 | ||
|
|
1f308c9ec3 | ||
|
|
4943d3aa53 | ||
|
|
828d561113 | ||
|
|
fcf72a7123 | ||
|
|
d3f5bc6e2d | ||
|
|
f525a05be8 | ||
|
|
fc7ec4299e | ||
|
|
21d053b1b6 | ||
|
|
68e64a5aa7 | ||
|
|
8e718fe288 | ||
|
|
efec9070e1 | ||
|
|
e3646d4d4a | ||
|
|
4219f16f61 | ||
|
|
c3b1802e95 | ||
|
|
40fe078021 | ||
|
|
a5a6600e74 | ||
|
|
03b9303f22 | ||
|
|
b5a59ea6f9 | ||
|
|
c6b2124129 | ||
|
|
d320a6facb | ||
|
|
0793c2cb8c | ||
|
|
d14755abb8 | ||
|
|
abd4aa2e6b | ||
|
|
58417e78e5 | ||
|
|
390eb1c6e9 | ||
|
|
d4c6530a72 | ||
|
|
ff17b44a41 | ||
|
|
5bd2d47571 | ||
|
|
f8e475cd34 | ||
|
|
a05e063949 | ||
|
|
eb06a90109 | ||
|
|
e2f6632fee | ||
|
|
5c5c583dcc | ||
|
|
0d8d5c02d0 | ||
|
|
382e0c6ad2 | ||
|
|
a8d1c44408 | ||
|
|
78b4318c34 | ||
|
|
b47031a099 | ||
|
|
0f7b65a921 | ||
|
|
33f7903aeb | ||
|
|
f3c2740917 | ||
|
|
09a57c7a52 | ||
|
|
9068f0606e | ||
|
|
c577b7e369 | ||
|
|
5850464ba7 | ||
|
|
50e240d5e4 | ||
|
|
75c2a45b25 | ||
|
|
c958d63897 | ||
|
|
b633b8d0d3 | ||
|
|
76948416a9 | ||
|
|
f4a527c57c | ||
|
|
c491baff0e | ||
|
|
6d05fc6f57 | ||
|
|
ca53add820 | ||
|
|
6fe3099ab4 | ||
|
|
a34eceb327 | ||
|
|
c9042c3186 | ||
|
|
b46fe0d51c | ||
|
|
6d1d3173fe | ||
|
|
030d044d03 | ||
|
|
29fb8e0f74 | ||
|
|
6e326976d5 | ||
|
|
03a7d72a62 | ||
|
|
f913febd71 | ||
|
|
daa0fbdc6b | ||
|
|
d4c52b599d | ||
|
|
ec88373eb7 | ||
|
|
4286cafdeb | ||
|
|
3880d8e2f2 | ||
|
|
671c84ad44 | ||
|
|
a0d687bb24 | ||
|
|
704385ff0a | ||
|
|
81a657edec | ||
|
|
9d0bad29c0 | ||
|
|
2fb8e32104 | ||
|
|
c522e499b2 | ||
|
|
4700955480 | ||
|
|
2c66081fa4 | ||
|
|
855e88da43 | ||
|
|
ad302db9a8 | ||
|
|
bfa5fff500 | ||
|
|
01c64fd554 | ||
|
|
13a2b92a32 | ||
|
|
29e79f8f61 | ||
|
|
8f7527ede0 | ||
|
|
7cd149a4d8 | ||
|
|
e45912fd8a | ||
|
|
56c4ba67c6 | ||
|
|
7e7ce2f38e | ||
|
|
7dc9eba2d0 | ||
|
|
f91d96b51a | ||
|
|
bc19609147 | ||
|
|
1ccaf3a0bd | ||
|
|
03bfd829da | ||
|
|
e1f7a1e0a0 | ||
|
|
ceeac0ecf0 | ||
|
|
c9d0eac739 | ||
|
|
8f24d924ee | ||
|
|
8537cc9edf | ||
|
|
58f3985567 | ||
|
|
872db67f21 | ||
|
|
006f90997a | ||
|
|
26b4776394 | ||
|
|
66c64459e6 | ||
|
|
dc8657f57f | ||
|
|
9d647b90e0 | ||
|
|
f5730c950b | ||
|
|
15d37daebd | ||
|
|
795c9876af | ||
|
|
45f653167d | ||
|
|
403d9b6ac1 | ||
|
|
722af5f659 | ||
|
|
471b9f02ec | ||
|
|
fd294b6f98 | ||
|
|
88baaa72be | ||
|
|
61084cf1ba | ||
|
|
5b63f0755a | ||
|
|
9eb5cf6c98 | ||
|
|
679db5a22b | ||
|
|
0e35168bdb | ||
|
|
035dcc7ab7 | ||
|
|
252deed5b9 | ||
|
|
c2c4cad753 | ||
|
|
42e76477cf | ||
|
|
1eade74e5a | ||
|
|
f1f0fa0aa9 | ||
|
|
deef158822 | ||
|
|
fef2006663 | ||
|
|
5c97fd576a | ||
|
|
c4eb6b7b65 | ||
|
|
31324761cc | ||
|
|
e495f03ee9 | ||
|
|
f5769627e4 | ||
|
|
06ad73f85b | ||
|
|
fa20363853 | ||
|
|
2564432e71 | ||
|
|
addf47600d | ||
|
|
7f534a7966 | ||
|
|
eabffece1f | ||
|
|
afed842ad1 | ||
|
|
c46cfb5d47 | ||
|
|
34fe42bbd9 | ||
|
|
0c1d96b749 | ||
|
|
9b67f52d56 | ||
|
|
d37907d35d | ||
|
|
fee8d0cf78 | ||
|
|
f5f9c6b81f | ||
|
|
4e3460a34b | ||
|
|
8545b6ce6b | ||
|
|
e417903c23 | ||
|
|
81eae3fa48 | ||
|
|
90c58087e8 | ||
|
|
19bc1e6313 | ||
|
|
4a4e8c87b8 | ||
|
|
f04e559dc2 | ||
|
|
8e5e657344 | ||
|
|
a4f1f62068 | ||
|
|
a3e279f06f | ||
|
|
d11954e80c | ||
|
|
812170ebce | ||
|
|
fdd3c77298 | ||
|
|
342de209a2 | ||
|
|
caeb32488e | ||
|
|
ff7e70f4d5 | ||
|
|
950f51909c | ||
|
|
f86e6d344c | ||
|
|
08581282dd | ||
|
|
e1e47e76ec | ||
|
|
3ff059848c | ||
|
|
22c7df5936 | ||
|
|
81a44d1340 | ||
|
|
2c089e6166 | ||
|
|
589dae7b0c | ||
|
|
3ff13189aa | ||
|
|
7151c3fac1 | ||
|
|
3e023b77dd | ||
|
|
e3fc89890c | ||
|
|
ce2a6cfe5c | ||
|
|
31d9eaf54c | ||
|
|
781c445d14 | ||
|
|
26a416399f | ||
|
|
f7dc7f039e | ||
|
|
3c74fea087 | ||
|
|
be0635bfd3 | ||
|
|
6723ef95c2 | ||
|
|
1a8fd62680 | ||
|
|
8b57ed46b1 | ||
|
|
25c08e56c2 | ||
|
|
0f148b6ab6 | ||
|
|
47575fe357 | ||
|
|
7c14453b5a | ||
|
|
a47d5536fa | ||
|
|
db8f7f21e8 | ||
|
|
3c312c55f1 | ||
|
|
2d11419cba | ||
|
|
07a4508944 | ||
|
|
62913739bb | ||
|
|
55e9d8d944 | ||
|
|
a9439d58c7 | ||
|
|
800ad40c4c | ||
|
|
62864637a3 | ||
|
|
4d4ac7ea24 | ||
|
|
119651482d | ||
|
|
ecf0a1a736 | ||
|
|
94942d1ac4 | ||
|
|
b0a5b54949 | ||
|
|
ac57eab8ac | ||
|
|
74a4144193 | ||
|
|
5c44cb0f01 | ||
|
|
c044d711ef | ||
|
|
f2132f6a7d | ||
|
|
69871b15ff | ||
|
|
f4ec02a592 | ||
|
|
53f7743678 | ||
|
|
15893bc558 | ||
|
|
73b974f1b5 | ||
|
|
0e7bdc208b | ||
|
|
e0a07b7a92 | ||
|
|
4da58e8846 | ||
|
|
966b9e5c2b | ||
|
|
1625192c81 | ||
|
|
c5e8c6603c | ||
|
|
37e541d326 | ||
|
|
862a827fe6 | ||
|
|
b96c5c9e4b | ||
|
|
f7e91f1f08 | ||
|
|
2d77178ba3 | ||
|
|
b38e6d8bf3 | ||
|
|
b601cdb6a5 | ||
|
|
2803154213 | ||
|
|
ae5297e6d7 | ||
|
|
fa7490fb38 | ||
|
|
bad80521a8 | ||
|
|
8303e30033 | ||
|
|
27de1e271e | ||
|
|
98cecfe940 | ||
|
|
2e65538fb5 | ||
|
|
e6371cbf9c | ||
|
|
0b8b6ac56a | ||
|
|
cc17cc4af7 | ||
|
|
6afd7e1a38 | ||
|
|
91e22c1fb3 | ||
|
|
ad6129816d | ||
|
|
409db9d7ef | ||
|
|
2ccd58e917 | ||
|
|
7585ad430a | ||
|
|
c105c5a449 | ||
|
|
54065b59a1 | ||
|
|
f9250ae522 | ||
|
|
2f8621ed3d | ||
|
|
98a3e7cffa | ||
|
|
d7f2966216 | ||
|
|
8687b214e7 | ||
|
|
f5f1f0da8e | ||
|
|
818359bfd0 | ||
|
|
8174005ac8 | ||
|
|
0180cae8c3 | ||
|
|
dd1ea541ec | ||
|
|
19aac5b14c | ||
|
|
f3f8a211cd | ||
|
|
3edcbc3b99 | ||
|
|
5a1cc8745e | ||
|
|
12495547c4 | ||
|
|
ff654ab094 | ||
|
|
e55f55cd3e | ||
|
|
29aad066f0 | ||
|
|
74d3bdc68c | ||
|
|
7f9b3a8666 | ||
|
|
426f6de16f | ||
|
|
cf19b81dd4 | ||
|
|
d4c7e95092 | ||
|
|
aa07b5bdd8 | ||
|
|
c7cbb22667 | ||
|
|
ff72b68731 | ||
|
|
433be0e46b | ||
|
|
900607034e | ||
|
|
733e6fa14f | ||
|
|
cd72eb20c6 | ||
|
|
d754e616a5 | ||
|
|
d613e0a488 | ||
|
|
942fa53ed9 | ||
|
|
1729841083 | ||
|
|
315d83bc88 | ||
|
|
223aa0ccd5 | ||
|
|
38494a48d8 | ||
|
|
38456bddb5 | ||
|
|
b8a12b0e5b | ||
|
|
2d37c0aa42 | ||
|
|
c8c693db53 | ||
|
|
cdff0fceea | ||
|
|
3b6f47aea1 | ||
|
|
7bc37651c3 | ||
|
|
4fe43c3e50 | ||
|
|
0826b7c3ca | ||
|
|
d219c5c4c6 | ||
|
|
1a498348ee | ||
|
|
c6b03555f7 | ||
|
|
bb1a270532 | ||
|
|
69ea4b846a | ||
|
|
373a0e4a7d | ||
|
|
f4f5ab2392 | ||
|
|
b20b3229bf | ||
|
|
77fb93bb61 | ||
|
|
ec72b46dcb | ||
|
|
367f1813de | ||
|
|
74116057a7 | ||
|
|
9deb40216e | ||
|
|
daef76ec0b | ||
|
|
569a29fbbc | ||
|
|
0c06bfd3d9 | ||
|
|
8f46f2cac8 | ||
|
|
8f48515b80 | ||
|
|
c7dab4abea | ||
|
|
5e4c4725bc | ||
|
|
9861d74221 | ||
|
|
bb3b606820 | ||
|
|
09fb51189e | ||
|
|
bd19899bbc | ||
|
|
b69753fb76 | ||
|
|
9dc1b5f6f5 | ||
|
|
55c1ac36e3 | ||
|
|
c12e6cdc09 | ||
|
|
85562e8b95 | ||
|
|
fd34cc0b87 | ||
|
|
6322393782 | ||
|
|
1f9e954610 | ||
|
|
6491746809 | ||
|
|
6d2f1ff81e | ||
|
|
c724e5fb20 | ||
|
|
600726976c | ||
|
|
49b5c2058d | ||
|
|
21df21b144 | ||
|
|
620e71e800 | ||
|
|
db2216848d | ||
|
|
cfffe91ed5 | ||
|
|
a95aed1047 | ||
|
|
2883a36c76 | ||
|
|
ac4245013f | ||
|
|
b09e484492 | ||
|
|
dc63ddb010 | ||
|
|
09778a8eab | ||
|
|
8cbe9f1bd0 | ||
|
|
be61689458 | ||
|
|
4b63bc051e | ||
|
|
a098ba5e79 | ||
|
|
edee4b3fe5 | ||
|
|
0c9013e60e | ||
|
|
701c4bcf27 | ||
|
|
22f2fac56b | ||
|
|
605125c0e7 | ||
|
|
65d0ee126a | ||
|
|
4db6435090 | ||
|
|
4383fd3c45 | ||
|
|
b6be76b0ab | ||
|
|
92d8fa1193 | ||
|
|
9c51bf3edf | ||
|
|
cf0e4e6f8c | ||
|
|
c3719f35e3 | ||
|
|
0b1f074bcf | ||
|
|
7fe8514434 | ||
|
|
37c4dcf8ba | ||
|
|
e33dd3c499 | ||
|
|
94be52886e | ||
|
|
6646aa5644 | ||
|
|
d556eba296 | ||
|
|
a5b573b2d3 | ||
|
|
18d30ea8fa | ||
|
|
4324ffccf4 | ||
|
|
182ee9d7e4 | ||
|
|
68c1cfed46 | ||
|
|
1159784538 | ||
|
|
e683b5fdec | ||
|
|
3c409c5070 | ||
|
|
4b7361dfe7 | ||
|
|
037d5c11a5 | ||
|
|
95d857e091 | ||
|
|
4efa087cd1 | ||
|
|
60f0003436 | ||
|
|
fdb265cd6e | ||
|
|
34704a17f2 | ||
|
|
4a959ec2fd | ||
|
|
f182886fce | ||
|
|
2fbaddbecf | ||
|
|
cafcecf03d | ||
|
|
49473845cf | ||
|
|
d4d4ed22a0 | ||
|
|
240ed6f0b1 | ||
|
|
084a24e958 | ||
|
|
cd9e3648e9 | ||
|
|
7ed51be4e6 | ||
|
|
0c8358ae67 | ||
|
|
25cefd9129 | ||
|
|
af75c0ca0c | ||
|
|
a91b2629d3 | ||
|
|
de9070dba1 | ||
|
|
813b518b6f | ||
|
|
c47e800f60 | ||
|
|
8398f45d43 | ||
|
|
aeaaa50f6c | ||
|
|
f33ce846b8 | ||
|
|
4718b9dc07 | ||
|
|
fba00f7c5a | ||
|
|
3360383fd7 | ||
|
|
6c30f62693 | ||
|
|
ab5b0382da | ||
|
|
671f3f5890 | ||
|
|
9bae445624 | ||
|
|
30529ccdf5 | ||
|
|
a8a02d3a2e | ||
|
|
5da33ca244 | ||
|
|
04c1e95f08 | ||
|
|
2186fc1fc7 | ||
|
|
fb49a9192e | ||
|
|
ccbc5abec6 | ||
|
|
7aa6fd479d | ||
|
|
3fcc16c1a0 | ||
|
|
b3e0298189 | ||
|
|
7e1fe7d852 | ||
|
|
5d7d77d4b6 | ||
|
|
418856769b | ||
|
|
46a32dd3ee | ||
|
|
ecb4dc57b4 | ||
|
|
89d426470b | ||
|
|
23c7a1b5b7 | ||
|
|
3b21e9434f | ||
|
|
d4a4428e64 | ||
|
|
2dfc057135 | ||
|
|
a25eebef9b | ||
|
|
741c4ca15a | ||
|
|
0bcdf2e4dc | ||
|
|
cd5a720211 | ||
|
|
5cb04946b0 | ||
|
|
c8953c6275 | ||
|
|
e8dc9c9454 | ||
|
|
a0c325681f | ||
|
|
8d3bf19422 | ||
|
|
4477867ef4 | ||
|
|
e696c884dc | ||
|
|
80bcaa49e6 | ||
|
|
0096c1bb02 | ||
|
|
38b37a068d | ||
|
|
0281f31df2 | ||
|
|
40b182c550 | ||
|
|
d1dedc7511 | ||
|
|
04cd9b3eb6 | ||
|
|
de6003367d | ||
|
|
a5f42eeddf | ||
|
|
a8ba041b67 | ||
|
|
e700fc6f34 | ||
|
|
af29d3d257 | ||
|
|
487701a143 | ||
|
|
f32e037c58 | ||
|
|
8bd903dd96 | ||
|
|
560c100484 | ||
|
|
52444d177b | ||
|
|
b4f7ff29ef | ||
|
|
f7c6a5bfa2 | ||
|
|
6fe14f7a6b | ||
|
|
786e5addd8 | ||
|
|
2e9a15f523 | ||
|
|
bb0d2ddc53 | ||
|
|
702fb014a5 | ||
|
|
834eab9457 | ||
|
|
a85da04601 | ||
|
|
414f1c27e4 | ||
|
|
c76e2eb900 | ||
|
|
c523e15302 | ||
|
|
2dc8de295d | ||
|
|
d645fd6327 | ||
|
|
219a7f3a07 | ||
|
|
d95e3e0055 | ||
|
|
2cc31ff425 | ||
|
|
8258fd7d9f | ||
|
|
784cca2233 | ||
|
|
436539a700 | ||
|
|
dcb3da9f28 | ||
|
|
a354c841f1 | ||
|
|
3824f064cd | ||
|
|
cba6db752b | ||
|
|
a458e26581 | ||
|
|
9d68727a84 | ||
|
|
38b9a874e0 | ||
|
|
7a680fb9f2 | ||
|
|
a5f9262adb | ||
|
|
b05e32fa8c | ||
|
|
53d8cff835 | ||
|
|
00fe97ff88 | ||
|
|
607511fd64 | ||
|
|
8663c265d8 | ||
|
|
6c5d35d6ce | ||
|
|
95532cb318 | ||
|
|
4d91bc5908 | ||
|
|
b13900402d | ||
|
|
1bb6c03bd0 | ||
|
|
1445949e31 | ||
|
|
360d3834ca | ||
|
|
aacdcad529 | ||
|
|
ad9341835f | ||
|
|
b028adb6af | ||
|
|
39f683b272 | ||
|
|
a6c46c89eb | ||
|
|
d534cf6f02 | ||
|
|
dd4326f7c4 | ||
|
|
40aecd688e | ||
|
|
63730a6e2c | ||
|
|
4d4d26aef8 | ||
|
|
de6b32d8c6 | ||
|
|
a0af7f0524 | ||
|
|
c043bd3422 | ||
|
|
18ae1d6940 | ||
|
|
d6f64f9773 | ||
|
|
db99a4cb90 | ||
|
|
108689661f | ||
|
|
d3e00dba8e | ||
|
|
fcd33e5035 | ||
|
|
af9082cd9f | ||
|
|
6a0bb18fca | ||
|
|
8aa8d87781 | ||
|
|
4998af8d7a | ||
|
|
c6aa95f3f3 | ||
|
|
481be29366 | ||
|
|
3617b6ad8c | ||
|
|
3fb8e19a38 | ||
|
|
2ea2f1b4f2 | ||
|
|
26cb8ec4f1 | ||
|
|
7fe56bea86 | ||
|
|
11b16b8a86 | ||
|
|
de020ee695 | ||
|
|
3b83487611 | ||
|
|
09bab4f162 | ||
|
|
49fcc799ca | ||
|
|
10bc803775 | ||
|
|
4f40770fc6 | ||
|
|
a4495c6ef1 | ||
|
|
67d837c4ec | ||
|
|
138825af6d | ||
|
|
c093841336 | ||
|
|
2df1da4226 | ||
|
|
2792d60e2d | ||
|
|
656a3ace07 | ||
|
|
aec8e88c14 | ||
|
|
bdd5ca140d | ||
|
|
8b3b0def03 | ||
|
|
6440ece177 | ||
|
|
bd3518637c | ||
|
|
aef2a1c484 | ||
|
|
a4b28e5737 | ||
|
|
a3bc2eb836 | ||
|
|
3059da5805 | ||
|
|
18d5a492c8 | ||
|
|
160b0ea7d9 | ||
|
|
4dd1267bea | ||
|
|
b5c4328682 | ||
|
|
571fc69ef4 | ||
|
|
f51595cfc9 | ||
|
|
d54aea0036 | ||
|
|
51bb2974bc | ||
|
|
7a859061fd | ||
|
|
cefa9fcd75 | ||
|
|
d3bacd0b73 | ||
|
|
b94a98fc90 | ||
|
|
e0b2687231 | ||
|
|
cc6179a4dd | ||
|
|
e947bac4a3 | ||
|
|
11ecbb6ca7 | ||
|
|
322789cd4c | ||
|
|
f28464dba0 | ||
|
|
8f6456b1f8 | ||
|
|
1f32786c82 | ||
|
|
829c729ee9 | ||
|
|
5d3aacb892 | ||
|
|
741e9c5ed5 | ||
|
|
1408c1b623 | ||
|
|
c256f8d09e | ||
|
|
55c018c525 | ||
|
|
3fa94b5143 | ||
|
|
5127e2f89c | ||
|
|
3175fa3aca | ||
|
|
5614174b39 | ||
|
|
39fc52fe0a | ||
|
|
81188705b1 | ||
|
|
63c4873d8a | ||
|
|
1a85dcd890 | ||
|
|
27470fc504 | ||
|
|
65d18445d3 | ||
|
|
84dd54b33a | ||
|
|
7c410d36e3 | ||
|
|
98a603a570 | ||
|
|
5876052170 | ||
|
|
f8303b4623 | ||
|
|
20005a7a22 | ||
|
|
4f0bfbab21 | ||
|
|
811442832e | ||
|
|
40811311d7 | ||
|
|
198de211f8 | ||
|
|
9f5412fa9d | ||
|
|
0dc9de81ae | ||
|
|
5b8f42ce5e | ||
|
|
5314274ed6 | ||
|
|
c831856711 | ||
|
|
1bade6d796 | ||
|
|
629a4a950e | ||
|
|
aebb1f6ec8 | ||
|
|
6e42bc55e0 | ||
|
|
1235fba7ee | ||
|
|
7a459db022 | ||
|
|
607987def5 | ||
|
|
397ec62180 | ||
|
|
9315210fbe | ||
|
|
5127990a43 | ||
|
|
40ad2b155a | ||
|
|
a0412d026c | ||
|
|
7d2134c488 | ||
|
|
d894f52b97 | ||
|
|
735f475c24 | ||
|
|
353dd73e24 | ||
|
|
49fe06498a | ||
|
|
bc95ec8084 | ||
|
|
f79906bf16 | ||
|
|
b3262fcb80 | ||
|
|
52b8f924aa | ||
|
|
52f57160aa | ||
|
|
6d4f23919c | ||
|
|
899623f71b | ||
|
|
c5d677ac7b | ||
|
|
c75270a9fc | ||
|
|
1588a379eb | ||
|
|
72d2075828 | ||
|
|
e99c682637 | ||
|
|
c815f70831 | ||
|
|
0da50eaa79 | ||
|
|
b0af84a549 | ||
|
|
b9631e8521 | ||
|
|
f664f7a201 | ||
|
|
f72b3882c3 | ||
|
|
ea47a2973c | ||
|
|
04be9ca670 | ||
|
|
6f0baf6ca9 | ||
|
|
1f5ec6b8d5 | ||
|
|
a2a91520aa | ||
|
|
fd7b5d3de7 | ||
|
|
30ea844c43 | ||
|
|
efac53b121 | ||
|
|
73c0ef59c1 | ||
|
|
7e65ab2d3b | ||
|
|
fec769f632 | ||
|
|
90e42642b6 | ||
|
|
9d9610a882 | ||
|
|
1fc81f4b66 | ||
|
|
4f0b1e847c | ||
|
|
9567ac32f2 | ||
|
|
8dd9cfa2a6 | ||
|
|
dbda8ef893 | ||
|
|
cd143c15d5 | ||
|
|
509a388ccc | ||
|
|
76c6482495 | ||
|
|
010a44f831 | ||
|
|
e6b0d644d4 | ||
|
|
02dc68c899 | ||
|
|
11ac97cd09 | ||
|
|
61f6565321 | ||
|
|
55d951f211 | ||
|
|
143ce6fcd5 | ||
|
|
e264c6ad2e | ||
|
|
036b6785f1 | ||
|
|
caf5cc90ae | ||
|
|
b05e98b1b6 | ||
|
|
31d0779377 | ||
|
|
6b056e915e | ||
|
|
9d6c0dc580 | ||
|
|
6e973e07f4 | ||
|
|
c8098b9eac | ||
|
|
ed20ce388a | ||
|
|
33e01e431d | ||
|
|
7d631e4959 | ||
|
|
29eb566448 | ||
|
|
a770d2a972 | ||
|
|
688cffb031 | ||
|
|
2cccc26541 | ||
|
|
f96f083bb5 | ||
|
|
2e078aff7d | ||
|
|
bd1f192dc4 | ||
|
|
b62f241051 | ||
|
|
95d1ac354e | ||
|
|
54728f5d57 | ||
|
|
d9356b0f86 | ||
|
|
6b68d9d90b | ||
|
|
359a8c4a81 | ||
|
|
dcb95d131b | ||
|
|
f4e37ba7c0 | ||
|
|
1cbceec0e1 | ||
|
|
5b3c5407a1 | ||
|
|
27a120c7c3 | ||
|
|
375f3e8bc1 | ||
|
|
a75b4af374 | ||
|
|
b2a4cd488d | ||
|
|
1d8d203e9e | ||
|
|
4e7fe460a5 | ||
|
|
9be14a63b1 | ||
|
|
afd3c76088 | ||
|
|
6b697506c3 | ||
|
|
3eba296157 | ||
|
|
1b51de08f5 | ||
|
|
3e37f3fa54 | ||
|
|
a18679e95d | ||
|
|
0154f81e33 | ||
|
|
366931952b | ||
|
|
606fc352aa | ||
|
|
75f817b39c | ||
|
|
0bc49bf244 | ||
|
|
930a84b459 | ||
|
|
21c89e8163 | ||
|
|
b3770cd26c | ||
|
|
0cd4d44bd3 | ||
|
|
af15e73e64 | ||
|
|
33f176b8f9 | ||
|
|
42f21972fd | ||
|
|
2d79e54c46 | ||
|
|
224408b0e8 | ||
|
|
610e447d7c | ||
|
|
c2c0e19305 | ||
|
|
e8c4b0d57c | ||
|
|
36e7684d9a | ||
|
|
795c079af0 | ||
|
|
94e1d3f0fc | ||
|
|
1df002de81 | ||
|
|
b7115659b3 | ||
|
|
258ec6b89a | ||
|
|
d1ecdfc510 | ||
|
|
a807e66d4a | ||
|
|
8f9921d00c | ||
|
|
99bc4e9a87 | ||
|
|
9289cfdde9 | ||
|
|
bedbe3caad | ||
|
|
2e329426ab | ||
|
|
4c68d03457 | ||
|
|
0911fa4fa2 | ||
|
|
c5737c5f74 | ||
|
|
106198fa20 | ||
|
|
4eb74a3c93 | ||
|
|
3f0bcc9568 | ||
|
|
f0c35fde6d | ||
|
|
8357eeb762 | ||
|
|
61da54d6ca | ||
|
|
efea47833d | ||
|
|
24ea08b6d3 | ||
|
|
2808b334ed | ||
|
|
96159cf739 | ||
|
|
577dfa4f54 | ||
|
|
66075d620e | ||
|
|
60f1d21914 | ||
|
|
b108621a59 | ||
|
|
4a4e703f16 | ||
|
|
61984730ac | ||
|
|
f196d3bab8 | ||
|
|
7da45cb49e | ||
|
|
e994305da6 | ||
|
|
2af37b484e | ||
|
|
faf41f7d96 | ||
|
|
7629e29397 | ||
|
|
1cff7fcfea | ||
|
|
694cf6e958 | ||
|
|
0e12fbb2a0 | ||
|
|
450ad45882 | ||
|
|
d674e50591 | ||
|
|
61f2f4b761 | ||
|
|
baa2f49b14 | ||
|
|
8c0bd234d8 | ||
|
|
c4fd41562f | ||
|
|
a1d1b4e49f | ||
|
|
96fb7a45f7 | ||
|
|
d5eedd2c65 | ||
|
|
fe4f907099 | ||
|
|
1b45eaf3de | ||
|
|
cfbc0a1579 | ||
|
|
db1b99d8dd | ||
|
|
65a880e9fa | ||
|
|
37b4005d3e | ||
|
|
70faa252e7 | ||
|
|
3620be8dbc | ||
|
|
21c64dd60f | ||
|
|
fb69d790ce | ||
|
|
debd066edd | ||
|
|
f58d81b1e9 | ||
|
|
8d507f161b | ||
|
|
b015f7c801 | ||
|
|
80abe952ba | ||
|
|
c12162407c | ||
|
|
7f5c3b223a | ||
|
|
2f3e4ebf39 | ||
|
|
2c14f8587e | ||
|
|
42224052e2 | ||
|
|
a8dd5aa0fc | ||
|
|
f3d0a9bc3f | ||
|
|
d629b9e36a | ||
|
|
4d54ba2200 | ||
|
|
0035ef9194 | ||
|
|
fcb20296d7 | ||
|
|
6bb9080017 | ||
|
|
bbde16dc08 | ||
|
|
ac9716f193 | ||
|
|
8a2bc1c21b | ||
|
|
942b474ad7 | ||
|
|
f3ef9b671f | ||
|
|
3538631e8e | ||
|
|
1577ab04e1 | ||
|
|
7f2dfaa5b4 | ||
|
|
fd126746f7 | ||
|
|
63f7e9feb0 | ||
|
|
5eb380e103 | ||
|
|
832e821919 | ||
|
|
197e3f144d | ||
|
|
056b5b41e2 | ||
|
|
15d40fd64a | ||
|
|
979d3da69c | ||
|
|
72984cc4a8 | ||
|
|
0a7a815124 | ||
|
|
1ce68a49c6 | ||
|
|
b1b6abf285 | ||
|
|
9dfd6970f1 | ||
|
|
3583c13339 | ||
|
|
00ab198c9f | ||
|
|
669d9a89ca | ||
|
|
9c54603726 | ||
|
|
dc09a50472 | ||
|
|
68eb7031e2 | ||
|
|
19623cac21 | ||
|
|
4ca25ca533 | ||
|
|
178c49a430 | ||
|
|
32e2cd9f06 | ||
|
|
7aa514d9ba | ||
|
|
7c2575d723 | ||
|
|
f93ea20d5e | ||
|
|
73cb6ff00d | ||
|
|
72267fa60b | ||
|
|
6b6a27e849 | ||
|
|
daea10121c | ||
|
|
999a1e514b | ||
|
|
be30960366 | ||
|
|
38e5084018 | ||
|
|
fdd9bb1af6 | ||
|
|
81546820ab | ||
|
|
84e87f0e8a | ||
|
|
901592a88e | ||
|
|
24f908d9be | ||
|
|
f62ff0ad66 | ||
|
|
8e0ecbeb8f | ||
|
|
095367f760 | ||
|
|
5d34eb12e0 | ||
|
|
d4e760efe1 | ||
|
|
75ab8e697b | ||
|
|
f4b05d46ed | ||
|
|
04c5f2c36a | ||
|
|
db50f95482 | ||
|
|
0e52a08a47 | ||
|
|
7b5d49ef60 | ||
|
|
430ba60b33 | ||
|
|
3af1f3bc63 | ||
|
|
bdcb94af81 | ||
|
|
2ea9e723c2 | ||
|
|
e19091d809 | ||
|
|
64ab59c0e0 | ||
|
|
4707b363aa | ||
|
|
1a72245c15 | ||
|
|
dea7b9050d | ||
|
|
3bd810fedc | ||
|
|
f9cbf8361d | ||
|
|
eccd4d0325 | ||
|
|
e0decf1233 | ||
|
|
100927f16c | ||
|
|
bb670f6658 | ||
|
|
d37992aaf9 | ||
|
|
9048ee533d | ||
|
|
2b1e5927ca | ||
|
|
b5e03030d1 | ||
|
|
65056bfa72 | ||
|
|
c50bb90374 | ||
|
|
ec4fc265e0 | ||
|
|
8ea41af5c4 | ||
|
|
966331dac7 | ||
|
|
cf056bace7 | ||
|
|
405a455906 | ||
|
|
3a8b431a5b | ||
|
|
3ce0c17237 | ||
|
|
61a2e0f104 | ||
|
|
7c44251216 | ||
|
|
26e70664d6 | ||
|
|
8ac27cc798 | ||
|
|
d314164fed | ||
|
|
d2cbed151b | ||
|
|
fc06ae58b2 | ||
|
|
a8768c78a2 | ||
|
|
ee8763f60d | ||
|
|
db633330fe | ||
|
|
c1ffafd663 | ||
|
|
72f35dc914 | ||
|
|
e5f82f53b9 | ||
|
|
e39e6893e0 | ||
|
|
9ab77d65f4 | ||
|
|
8ed96cad1d | ||
|
|
7795eb8239 | ||
|
|
207c7ab1e0 | ||
|
|
27af79684f | ||
|
|
6b61a8eed1 | ||
|
|
181e6eac75 | ||
|
|
fd1979857c | ||
|
|
448bc3facd | ||
|
|
97cabadb88 | ||
|
|
8e284a70b7 | ||
|
|
73f9febe06 | ||
|
|
6a6cc22e9c | ||
|
|
b293639b76 | ||
|
|
f06036be09 | ||
|
|
867571af78 | ||
|
|
f6314d3124 | ||
|
|
1e87dd7903 |
-19
@@ -1,19 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
SimGear.spec
|
|
||||||
aclocal.m4
|
|
||||||
autom4te.cache
|
|
||||||
config.cache
|
|
||||||
config.log
|
|
||||||
config.status
|
|
||||||
configure
|
|
||||||
do-config.sh
|
|
||||||
.cdtproject
|
|
||||||
.project
|
|
||||||
config.guess
|
|
||||||
config.sub
|
|
||||||
depcomp
|
|
||||||
INSTALL
|
|
||||||
install-sh
|
|
||||||
missing
|
|
||||||
mkinstalldirs
|
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
Makefile
|
||||||
|
Makefile.in
|
||||||
|
.deps
|
||||||
|
autom4te.cache
|
||||||
|
config.guess
|
||||||
|
config.log
|
||||||
|
config.status
|
||||||
|
config.sub
|
||||||
|
configure
|
||||||
|
depcomp
|
||||||
|
install-sh
|
||||||
|
missing
|
||||||
|
aclocal.m4
|
||||||
|
INSTALL
|
||||||
|
SimGear.spec
|
||||||
|
*.o
|
||||||
|
lib*.a
|
||||||
|
cmake_install.cmake
|
||||||
|
CMakeFiles
|
||||||
|
CMakeCache.txt
|
||||||
|
CPackConfig.cmake
|
||||||
|
CPackSourceConfig.cmake
|
||||||
|
cmake_uninstall.cmake
|
||||||
|
CTestTestfile.cmake
|
||||||
|
install_manifest.txt
|
||||||
|
|
||||||
+160
@@ -0,0 +1,160 @@
|
|||||||
|
cmake_minimum_required (VERSION 2.6)
|
||||||
|
include (CheckFunctionExists)
|
||||||
|
include (CheckIncludeFile)
|
||||||
|
include (CheckCXXSourceCompiles)
|
||||||
|
include (CPack)
|
||||||
|
|
||||||
|
project(SimGear)
|
||||||
|
|
||||||
|
# read 'version' file into a variable (stripping any newlines or spaces)
|
||||||
|
file(READ version versionFile)
|
||||||
|
string(STRIP ${versionFile} SIMGEAR_VERSION)
|
||||||
|
|
||||||
|
#packaging
|
||||||
|
SET(CPACK_RESOURCE_FILE_LICENSE "${PROJECT_SOURCE_DIR}/COPYING")
|
||||||
|
SET(CPACK_RESOURCE_FILE_README "${PROJECT_SOURCE_DIR}/README")
|
||||||
|
|
||||||
|
# We have some custom .cmake scripts not in the official distribution.
|
||||||
|
set(CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/CMakeModules;${CMAKE_MODULE_PATH}")
|
||||||
|
|
||||||
|
option(SIMGEAR_SHARED "Set to ON to build SimGear as a shared library/framework" OFF)
|
||||||
|
option(SIMGEAR_HEADLESS "Set to ON to build SimGear with GUI/graphics support" OFF)
|
||||||
|
option(JPEG_FACTORY "Enable JPEG-factory support" OFF)
|
||||||
|
option(ENABLE_LIBSVN "Set to ON to build SimGear with libsvnclient support" ON)
|
||||||
|
|
||||||
|
set(MSVC_3RDPARTY_ROOT NOT_FOUND CACHE PATH "Location where the third-party dependencies are extracted")
|
||||||
|
|
||||||
|
if (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
message(STATUS "3rdparty files located in ${MSVC_3RDPARTY_ROOT}")
|
||||||
|
set( OSG_MSVC "msvc" )
|
||||||
|
if (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}100 )
|
||||||
|
else (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}90 )
|
||||||
|
endif (${MSVC_VERSION} EQUAL 1600)
|
||||||
|
if (CMAKE_CL_64)
|
||||||
|
set( OSG_MSVC ${OSG_MSVC}-64 )
|
||||||
|
set( MSVC_3RDPARTY_DIR 3rdParty.x64 )
|
||||||
|
else (CMAKE_CL_64)
|
||||||
|
set( MSVC_3RDPARTY_DIR 3rdParty )
|
||||||
|
endif (CMAKE_CL_64)
|
||||||
|
|
||||||
|
set (CMAKE_LIBRARY_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/lib )
|
||||||
|
set (CMAKE_INCLUDE_PATH ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include ${MSVC_3RDPARTY_ROOT}/install/${OSG_MSVC}/OpenScenegraph/include)
|
||||||
|
set (BOOST_ROOT ${MSVC_3RDPARTY_ROOT}/boost_1_44_0)
|
||||||
|
set (OPENAL_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
||||||
|
set (ALUT_INCLUDE_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/include)
|
||||||
|
set (OPENAL_LIBRARY_DIR ${MSVC_3RDPARTY_ROOT}/${MSVC_3RDPARTY_DIR}/lib)
|
||||||
|
endif (MSVC AND MSVC_3RDPARTY_ROOT)
|
||||||
|
|
||||||
|
find_package(Boost REQUIRED)
|
||||||
|
set (BOOST_CXX_FLAGS "-DBOOST_MULTI_INDEX_DISABLE_SERIALIZATION -DBOOST_BIMAP_DISABLE_SERIALIZATION")
|
||||||
|
|
||||||
|
find_package(ZLIB REQUIRED)
|
||||||
|
find_package(Threads REQUIRED)
|
||||||
|
|
||||||
|
if (${SIMGEAR_HEADLESS})
|
||||||
|
message(STATUS "headlesss mode")
|
||||||
|
set(NO_OPENSCENEGRAPH_INTERFACE 1)
|
||||||
|
else()
|
||||||
|
find_package(OpenGL REQUIRED)
|
||||||
|
find_package(OpenAL REQUIRED)
|
||||||
|
find_package(ALUT REQUIRED)
|
||||||
|
find_package(OpenSceneGraph 2.8.1 REQUIRED osgText osgSim osgDB osgParticle osgUtil)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(JPEG_FACTORY)
|
||||||
|
message(STATUS "JPEG-factory enabled")
|
||||||
|
find_package(JPEG REQUIRED)
|
||||||
|
include_directories(${JPEG_INCLUDE_DIR})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(ENABLE_LIBSVN)
|
||||||
|
find_package(SvnClient)
|
||||||
|
|
||||||
|
if(LIBSVN_FOUND)
|
||||||
|
message(STATUS "libsvn found, enabling in SimGear")
|
||||||
|
set(HAVE_SVN_CLIENT_H 1)
|
||||||
|
set(HAVE_LIBSVN_CLIENT_1 1)
|
||||||
|
else()
|
||||||
|
message(STATUS "Missing libsvn, unable to enable SVN in SimGear")
|
||||||
|
endif(LIBSVN_FOUND)
|
||||||
|
endif(ENABLE_LIBSVN)
|
||||||
|
|
||||||
|
check_include_file(sys/time.h HAVE_SYS_TIME_H)
|
||||||
|
check_include_file(sys/timeb.h HAVE_SYS_TIMEB_H)
|
||||||
|
check_include_file(unistd.h HAVE_UNISTD_H)
|
||||||
|
check_include_file(windows.h HAVE_WINDOWS_H)
|
||||||
|
|
||||||
|
# See if we have any rti library variant installed
|
||||||
|
find_package(RTI)
|
||||||
|
|
||||||
|
check_function_exists(gettimeofday HAVE_GETTIMEOFDAY)
|
||||||
|
check_function_exists(ftime HAVE_FTIME)
|
||||||
|
check_function_exists(timegm HAVE_TIMEGM)
|
||||||
|
check_function_exists(rint HAVE_RINT)
|
||||||
|
|
||||||
|
SET(CMAKE_DEBUG_POSTFIX "d" CACHE STRING "add a postfix, usually d on windows")
|
||||||
|
SET(CMAKE_RELEASE_POSTFIX "" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
SET(CMAKE_RELWITHDEBINFO_POSTFIX "rd" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
SET(CMAKE_MINSIZEREL_POSTFIX "s" CACHE STRING "add a postfix, usually empty on windows")
|
||||||
|
|
||||||
|
# isnan might not be real symbol, so can't check using function_exists
|
||||||
|
check_cxx_source_compiles(
|
||||||
|
"#include <cmath>
|
||||||
|
void f() { isnan(0.0);} "
|
||||||
|
HAVE_ISNAN)
|
||||||
|
|
||||||
|
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
set(WARNING_FLAGS -Wall)
|
||||||
|
endif(CMAKE_COMPILER_IS_GNUCXX)
|
||||||
|
|
||||||
|
if(WIN32)
|
||||||
|
|
||||||
|
if(MSVC)
|
||||||
|
# turn off various warnings
|
||||||
|
# foreach(warning 4244 4251 4267 4275 4290 4786 4305 4996)
|
||||||
|
# SET(WARNING_FLAGS "${WARNING_FLAGS} /wd${warning}")
|
||||||
|
# endforeach(warning)
|
||||||
|
|
||||||
|
set(MSVC_FLAGS "-DWIN32 -DNOMINMAX -D_USE_MATH_DEFINES -D_CRT_SECURE_NO_WARNINGS -D__CRT_NONSTDC_NO_WARNINGS")
|
||||||
|
endif(MSVC)
|
||||||
|
|
||||||
|
# assumed on Windows
|
||||||
|
set(HAVE_GETLOCALTIME 1)
|
||||||
|
endif(WIN32)
|
||||||
|
|
||||||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS}")
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${WARNING_FLAGS} ${MSVC_FLAGS} ${BOOST_CXX_FLAGS}")
|
||||||
|
|
||||||
|
include_directories(${PROJECT_SOURCE_DIR})
|
||||||
|
include_directories(${PROJECT_BINARY_DIR}/simgear)
|
||||||
|
|
||||||
|
include_directories(${OPENSCENEGRAPH_INCLUDE_DIRS}
|
||||||
|
${Boost_INCLUDE_DIRS} ${ZLIB_INCLUDE_DIR}
|
||||||
|
${ALUT_INCLUDE_DIR} ${OPENAL_INCLUDE_DIR} )
|
||||||
|
|
||||||
|
|
||||||
|
add_definitions(-DHAVE_CONFIG_H)
|
||||||
|
|
||||||
|
# configure a header file to pass some of the CMake settings
|
||||||
|
# to the source code
|
||||||
|
configure_file (
|
||||||
|
"${PROJECT_SOURCE_DIR}/simgear/simgear_config_cmake.h.in"
|
||||||
|
"${PROJECT_BINARY_DIR}/simgear/simgear_config.h"
|
||||||
|
)
|
||||||
|
|
||||||
|
install (FILES ${PROJECT_BINARY_DIR}/simgear/simgear_config.h DESTINATION include/simgear/)
|
||||||
|
add_subdirectory(simgear)
|
||||||
|
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
### uninstall target
|
||||||
|
#-----------------------------------------------------------------------------
|
||||||
|
CONFIGURE_FILE(
|
||||||
|
"${CMAKE_CURRENT_SOURCE_DIR}/CMakeModules/cmake_uninstall.cmake.in"
|
||||||
|
"${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake"
|
||||||
|
IMMEDIATE @ONLY)
|
||||||
|
ADD_CUSTOM_TARGET(uninstall
|
||||||
|
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake_uninstall.cmake")
|
||||||
|
|
||||||
|
|
||||||
@@ -0,0 +1,67 @@
|
|||||||
|
# Locate ALUT
|
||||||
|
# This module defines
|
||||||
|
# ALUT_LIBRARY
|
||||||
|
# ALUT_FOUND, if false, do not try to link to ALUT
|
||||||
|
# ALUT_INCLUDE_DIR, where to find the headers
|
||||||
|
#
|
||||||
|
# $ALUTDIR is an environment variable that would
|
||||||
|
# correspond to the ./configure --prefix=$ALUTDIR
|
||||||
|
# used in building ALUT.
|
||||||
|
#
|
||||||
|
# Created by James Turner. This was influenced by the FindOpenAL.cmake module.
|
||||||
|
|
||||||
|
#=============================================================================
|
||||||
|
# Copyright 2005-2009 Kitware, Inc.
|
||||||
|
#
|
||||||
|
# Distributed under the OSI-approved BSD License (the "License");
|
||||||
|
# see accompanying file Copyright.txt for details.
|
||||||
|
#
|
||||||
|
# This software is distributed WITHOUT ANY WARRANTY; without even the
|
||||||
|
# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||||
|
# See the License for more information.
|
||||||
|
#=============================================================================
|
||||||
|
# (To distributed this file outside of CMake, substitute the full
|
||||||
|
# License text for the above reference.)
|
||||||
|
|
||||||
|
# Per my request, CMake should search for frameworks first in
|
||||||
|
# the following order:
|
||||||
|
# ~/Library/Frameworks/OpenAL.framework/Headers
|
||||||
|
# /Library/Frameworks/OpenAL.framework/Headers
|
||||||
|
# /System/Library/Frameworks/OpenAL.framework/Headers
|
||||||
|
#
|
||||||
|
# On OS X, this will prefer the Framework version (if found) over others.
|
||||||
|
# People will have to manually change the cache values of
|
||||||
|
# OPENAL_LIBRARY to override this selection or set the CMake environment
|
||||||
|
# CMAKE_INCLUDE_PATH to modify the search paths.
|
||||||
|
|
||||||
|
FIND_PATH(ALUT_INCLUDE_DIR alut.h
|
||||||
|
HINTS
|
||||||
|
$ENV{ALUTDIR}
|
||||||
|
PATH_SUFFIXES include/AL include/ALUT include
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
FIND_LIBRARY(ALUT_LIBRARY
|
||||||
|
NAMES ALUT alut
|
||||||
|
HINTS
|
||||||
|
$ENV{ALUTDIR}
|
||||||
|
PATH_SUFFIXES lib64 lib libs64 libs libs/Win32 libs/Win64
|
||||||
|
PATHS
|
||||||
|
~/Library/Frameworks
|
||||||
|
/Library/Frameworks
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
|
||||||
|
SET(ALUT_FOUND "NO")
|
||||||
|
IF(ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
|
||||||
|
SET(ALUT_FOUND "YES")
|
||||||
|
ENDIF(ALUT_LIBRARY AND ALUT_INCLUDE_DIR)
|
||||||
|
|
||||||
@@ -0,0 +1,51 @@
|
|||||||
|
# Find Subversion client libraries, and dependencies
|
||||||
|
# including APR (Apache Portable Runtime)
|
||||||
|
|
||||||
|
include (CheckFunctionExists)
|
||||||
|
include (CheckIncludeFile)
|
||||||
|
|
||||||
|
find_program(HAVE_APR_CONFIG apr-1-config)
|
||||||
|
if(HAVE_APR_CONFIG)
|
||||||
|
|
||||||
|
execute_process(COMMAND apr-1-config --cppflags --includes
|
||||||
|
OUTPUT_VARIABLE APR_CFLAGS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
execute_process(COMMAND apr-1-config --link-ld
|
||||||
|
OUTPUT_VARIABLE RAW_APR_LIBS
|
||||||
|
OUTPUT_STRIP_TRAILING_WHITESPACE)
|
||||||
|
|
||||||
|
# clean up some vars, or other CMake pieces complain
|
||||||
|
string(STRIP ${RAW_APR_LIBS} APR_LIBS)
|
||||||
|
|
||||||
|
else(HAVE_APR_CONFIG)
|
||||||
|
message(STATUS "apr-1-config not found, implement manual search for APR")
|
||||||
|
endif(HAVE_APR_CONFIG)
|
||||||
|
|
||||||
|
if(HAVE_APR_CONFIG)
|
||||||
|
find_path(LIBSVN_INCLUDE_DIR svn_client.h
|
||||||
|
HINTS
|
||||||
|
$ENV{LIBSVN_DIR}
|
||||||
|
PATH_SUFFIXES include/subversion-1
|
||||||
|
PATHS
|
||||||
|
/usr/local
|
||||||
|
/usr
|
||||||
|
/opt
|
||||||
|
)
|
||||||
|
|
||||||
|
check_library_exists(svn_client-1 svn_client_checkout "" HAVE_LIB_SVNCLIENT)
|
||||||
|
check_library_exists(svn_subr-1 svn_cmdline_init "" HAVE_LIB_SVNSUBR)
|
||||||
|
check_library_exists(svn_ra-1 svn_ra_initialize "" HAVE_LIB_SVNRA)
|
||||||
|
|
||||||
|
include(FindPackageHandleStandardArgs)
|
||||||
|
FIND_PACKAGE_HANDLE_STANDARD_ARGS(LIBSVN DEFAULT_MSG
|
||||||
|
HAVE_LIB_SVNSUBR
|
||||||
|
HAVE_LIB_SVNCLIENT
|
||||||
|
HAVE_LIB_SVNRA
|
||||||
|
LIBSVN_INCLUDE_DIR)
|
||||||
|
|
||||||
|
if(LIBSVN_FOUND)
|
||||||
|
set(LIBSVN_LIBRARIES "svn_client-1" "svn_subr-1" "svn_ra-1" ${APR_LIBS})
|
||||||
|
endif(LIBSVN_FOUND)
|
||||||
|
endif(HAVE_APR_CONFIG)
|
||||||
|
|
||||||
@@ -0,0 +1,23 @@
|
|||||||
|
|
||||||
|
macro(simgear_component name includePath sources headers)
|
||||||
|
|
||||||
|
if (SIMGEAR_SHARED)
|
||||||
|
foreach(s ${sources})
|
||||||
|
set_property(GLOBAL
|
||||||
|
APPEND PROPERTY ALL_SOURCES "${CMAKE_CURRENT_SOURCE_DIR}/${s}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
foreach(h ${headers})
|
||||||
|
set_property(GLOBAL
|
||||||
|
APPEND PROPERTY PUBLIC_HEADERS "${CMAKE_CURRENT_SOURCE_DIR}/${h}")
|
||||||
|
endforeach()
|
||||||
|
|
||||||
|
else()
|
||||||
|
set(libName "sg${name}")
|
||||||
|
add_library(${libName} STATIC ${sources} )
|
||||||
|
|
||||||
|
install (TARGETS ${libName} ARCHIVE DESTINATION lib${LIB_SUFFIX})
|
||||||
|
install (FILES ${headers} DESTINATION include/simgear/${includePath})
|
||||||
|
endif()
|
||||||
|
|
||||||
|
endmacro()
|
||||||
@@ -0,0 +1,22 @@
|
|||||||
|
IF(NOT EXISTS "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt")
|
||||||
|
MESSAGE(FATAL_ERROR "Cannot find install manifest: \"@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt\"")
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
|
FILE(READ "@CMAKE_CURRENT_BINARY_DIR@/install_manifest.txt" files)
|
||||||
|
STRING(REGEX REPLACE "\n" ";" files "${files}")
|
||||||
|
|
||||||
|
FOREACH(file ${files})
|
||||||
|
MESSAGE(STATUS "Uninstalling \"${file}\"")
|
||||||
|
IF(EXISTS "${file}")
|
||||||
|
EXEC_PROGRAM(
|
||||||
|
"@CMAKE_COMMAND@" ARGS "-E remove \"${file}\""
|
||||||
|
OUTPUT_VARIABLE rm_out
|
||||||
|
RETURN_VALUE rm_retval
|
||||||
|
)
|
||||||
|
IF(NOT "${rm_retval}" STREQUAL 0)
|
||||||
|
MESSAGE(FATAL_ERROR "Problem when removing \"${file}\"")
|
||||||
|
ENDIF()
|
||||||
|
ELSE()
|
||||||
|
MESSAGE(STATUS "File \"${file}\" does not exist.")
|
||||||
|
ENDIF()
|
||||||
|
ENDFOREACH()
|
||||||
@@ -22,7 +22,7 @@ PROJECT_NAME = SimGear
|
|||||||
# This could be handy for archiving the generated documentation or
|
# This could be handy for archiving the generated documentation or
|
||||||
# if some version control system is used.
|
# if some version control system is used.
|
||||||
|
|
||||||
PROJECT_NUMBER = 0.3.8
|
PROJECT_NUMBER = 2.2.0
|
||||||
|
|
||||||
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute)
|
||||||
# base path where the generated documentation will be put.
|
# base path where the generated documentation will be put.
|
||||||
@@ -303,16 +303,19 @@ INPUT = \
|
|||||||
simgear/compiler.h \
|
simgear/compiler.h \
|
||||||
simgear/constants.h \
|
simgear/constants.h \
|
||||||
simgear/debug \
|
simgear/debug \
|
||||||
|
simgear/environment \
|
||||||
simgear/ephemeris \
|
simgear/ephemeris \
|
||||||
simgear/io \
|
simgear/io \
|
||||||
simgear/magvar \
|
simgear/magvar \
|
||||||
simgear/math \
|
simgear/math \
|
||||||
simgear/misc \
|
simgear/misc \
|
||||||
|
simgear/nasal \
|
||||||
simgear/props \
|
simgear/props \
|
||||||
simgear/route \
|
simgear/route \
|
||||||
simgear/scene \
|
simgear/scene \
|
||||||
simgear/screen \
|
simgear/screen \
|
||||||
simgear/serial \
|
simgear/serial \
|
||||||
|
simgear/structure \
|
||||||
simgear/sg_inlines.h \
|
simgear/sg_inlines.h \
|
||||||
simgear/sg_traits.hxx \
|
simgear/sg_traits.hxx \
|
||||||
simgear/sound \
|
simgear/sound \
|
||||||
|
|||||||
+5
-7
@@ -2,15 +2,13 @@ EXTRA_DIST = \
|
|||||||
acinclude.m4 \
|
acinclude.m4 \
|
||||||
autogen.sh \
|
autogen.sh \
|
||||||
DoxygenMain.cxx \
|
DoxygenMain.cxx \
|
||||||
README.MSVC \
|
|
||||||
README.zlib \
|
README.zlib \
|
||||||
SimGear.dsp \
|
README.plib \
|
||||||
SimGear.dsw
|
README.OpenAL \
|
||||||
|
README.OSG \
|
||||||
|
projects
|
||||||
|
|
||||||
SUBDIRS = src-libs simgear
|
SUBDIRS = simgear
|
||||||
|
|
||||||
dist-hook:
|
|
||||||
(cd $(top_srcdir); $(HOME)/Projects/FlightGear-0.9/admin/am2dsp.pl)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Rule to build RPM distribution package
|
# Rule to build RPM distribution package
|
||||||
|
|||||||
@@ -1,7 +1,74 @@
|
|||||||
|
Version 1.9.0
|
||||||
|
* Thu Dec 18 15:12:15 CST 2008
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.8.6
|
||||||
|
* Mon Dec 1 14:02:47 CST 2008
|
||||||
|
|
||||||
|
|
||||||
|
Version 1.8.5
|
||||||
|
* October 30, 2008 (source code snapshot release)
|
||||||
|
|
||||||
|
|
||||||
|
New in 0.3.10
|
||||||
|
* April 5, 2006
|
||||||
|
|
||||||
|
* Add a small accessor function to expose local timezone offset.
|
||||||
|
* Improved exception handling and made output more helpful in various places.
|
||||||
|
* Better pbuffer runtime detection.
|
||||||
|
* Add directory creation capability to file/path library.
|
||||||
|
* Added a basic reference counting class to improve robustness of
|
||||||
|
memory management in places. Use this for all scenegraph
|
||||||
|
references, sgmaterial references, sgmatmodel references, and
|
||||||
|
sgsoundsample references.
|
||||||
|
* Add support for point sprites.
|
||||||
|
* Updates to rain cone rendering.
|
||||||
|
* Add a new vector library and integrate that with improved coordinate
|
||||||
|
system conversion code.
|
||||||
|
* Mutex locking and cleanup improvements in the threading abstraction
|
||||||
|
library.
|
||||||
|
* Add MacOS RenderTexture support.
|
||||||
|
* Add a Nasal based io libarary that is not activated by default.
|
||||||
|
* Added a set of MS-VC8 project files.
|
||||||
|
|
||||||
|
* Various platform related bug fixes.
|
||||||
|
* Various compiler related bug/warning fixes.
|
||||||
|
* Clean up some things that triggered valgrind warnings.
|
||||||
|
* Fix a Nasal cmp() bug.
|
||||||
|
* Removed ancient version of zlib from distribution.
|
||||||
|
|
||||||
|
|
||||||
|
New in 0.3.9
|
||||||
|
* November 17, 2005
|
||||||
|
|
||||||
|
* Add support for OpenAL 1.1 (with a separate alut library.)
|
||||||
|
* Add support for volumetric shadows. Aircraft can cast shadows on themselves
|
||||||
|
as well as onto the ground (by Harald Johnsen.)
|
||||||
|
* New 3d volumetric clouds by Harald Johnsen (along with several rounds of
|
||||||
|
followup fixes and improvements.)
|
||||||
|
* Remove Mark Harris's old 3d clouds because they were never properly
|
||||||
|
integrated. And we now have new 3d clouds.
|
||||||
|
* Add support for seasonal textures (with a set of winter textures added
|
||||||
|
to FlightGear.)
|
||||||
|
* Updated Nasal scripting system. Adds several new syntax convenience
|
||||||
|
features, fixes parser bugs, fixes several internal bugs.
|
||||||
|
* Our 3d cockpit jitter problem is fixed (woohoo!)
|
||||||
|
* Add code to support rendering to a texture.
|
||||||
|
* Allow "tip" popups to pop themselves down after the appropriate
|
||||||
|
timeout, even if the sim time is paused.
|
||||||
|
* Various low model level animation fixes and additions ... color,
|
||||||
|
transparency, 'chrome' effects, randomized spin, etc.
|
||||||
|
* Create our own portable stdint.h implementation.
|
||||||
|
* Fixed several memory leaks.
|
||||||
|
* removeChildren() added to the property system.
|
||||||
|
* Fix many cases of 'const'.
|
||||||
|
* Fixes for cygwin, solaris/sun, Mac OS X, MSVC, gcc-3.4.x.
|
||||||
|
|
||||||
|
|
||||||
New in 0.3.8
|
New in 0.3.8
|
||||||
* January 18, 2005
|
* January 18, 2005
|
||||||
|
|
||||||
* Configure script does a sanity check for the existance of openal.
|
* Configure script does a sanity check for the existence of openal.
|
||||||
* Better pthreads detection for FreeBSD.
|
* Better pthreads detection for FreeBSD.
|
||||||
* Abstract out the location of gl.h, glu.h, and glut.h so we can more
|
* Abstract out the location of gl.h, glu.h, and glut.h so we can more
|
||||||
easily support MacOS which puts these in an oddball location.
|
easily support MacOS which puts these in an oddball location.
|
||||||
@@ -15,7 +82,7 @@ New in 0.3.8
|
|||||||
* Fixes to property tree loading and saving.
|
* Fixes to property tree loading and saving.
|
||||||
* Make volume inaudible at startup.
|
* Make volume inaudible at startup.
|
||||||
* Solaris fixes.
|
* Solaris fixes.
|
||||||
* For low density cloud coverages, blend the layer to nothing as we pass
|
* For low density cloud coverage, blend the layer to nothing as we pass
|
||||||
through instead of fully engulfing the aircraft in the cloud.
|
through instead of fully engulfing the aircraft in the cloud.
|
||||||
* Add several new capabilities to the texture management code for building
|
* Add several new capabilities to the texture management code for building
|
||||||
normal maps and doing some simple on-the-fly effects on textures.
|
normal maps and doing some simple on-the-fly effects on textures.
|
||||||
@@ -58,7 +125,7 @@ New in 0.3.5
|
|||||||
* Support VASI/PAPI lights correctly.
|
* Support VASI/PAPI lights correctly.
|
||||||
* Fixes to cloud animation.
|
* Fixes to cloud animation.
|
||||||
* Updates to sky dome coloring as well as sun/moon coloring.
|
* Updates to sky dome coloring as well as sun/moon coloring.
|
||||||
* Vary environment lighting with visibility (subtlely.)
|
* Vary environment lighting with visibility (subtlety.)
|
||||||
* Support control of alpha test in model animation.
|
* Support control of alpha test in model animation.
|
||||||
* Complete rewrite of the event manager.
|
* Complete rewrite of the event manager.
|
||||||
* Updates to low level socket code to make it more flexible.
|
* Updates to low level socket code to make it more flexible.
|
||||||
@@ -109,7 +176,7 @@ New in 0.3.2
|
|||||||
management, basic model and model animation management, sky
|
management, basic model and model animation management, sky
|
||||||
rendering, and low level loaders for the "TerraGear" tile object format.
|
rendering, and low level loaders for the "TerraGear" tile object format.
|
||||||
* Removed support of the flat shaded and non-textured material
|
* Removed support of the flat shaded and non-textured material
|
||||||
property varients. You can still do these things, but extra states
|
property variants. You can still do these things, but extra states
|
||||||
are no longer set up automatically.
|
are no longer set up automatically.
|
||||||
* Removed 3d clouds from the default build ... these need a maintainer
|
* Removed 3d clouds from the default build ... these need a maintainer
|
||||||
or better yet, a complete plib-based rewrite.
|
or better yet, a complete plib-based rewrite.
|
||||||
@@ -154,7 +221,7 @@ New in 0.2.0
|
|||||||
* Removed efence support (in favor of valgrind.)
|
* Removed efence support (in favor of valgrind.)
|
||||||
|
|
||||||
* Added a javascript interpreter.
|
* Added a javascript interpreter.
|
||||||
* SGSocket reimplimented on top of plib/net libs.
|
* SGSocket reimplemented on top of plib/net libs.
|
||||||
* Added a new random number generation algorithm.
|
* Added a new random number generation algorithm.
|
||||||
* Total rewrite of the strutils package.
|
* Total rewrite of the strutils package.
|
||||||
|
|
||||||
@@ -164,7 +231,7 @@ New in 0.2.0
|
|||||||
* Mac OS X fixes.
|
* Mac OS X fixes.
|
||||||
* Irix fixes.
|
* Irix fixes.
|
||||||
* Code clean ups to remove warning messages.
|
* Code clean ups to remove warning messages.
|
||||||
* Optimizations in sg_binobj to reduce the amout of memory copying
|
* Optimizations in sg_binobj to reduce the amount of memory copying
|
||||||
needed when loading a binobj format file.
|
needed when loading a binobj format file.
|
||||||
* Fixed a couple places where variables could be used before they were
|
* Fixed a couple places where variables could be used before they were
|
||||||
initialized.
|
initialized.
|
||||||
@@ -184,7 +251,7 @@ New in 0.0.18
|
|||||||
* Upgrade to metakit-2.4.2-32.tar.gz (latest upstream release)
|
* Upgrade to metakit-2.4.2-32.tar.gz (latest upstream release)
|
||||||
* Added support for point objects in the scenery file format.
|
* Added support for point objects in the scenery file format.
|
||||||
* Additions to the binary file format to make it *much* more flexible.
|
* Additions to the binary file format to make it *much* more flexible.
|
||||||
For each major primative type: points, triangles, fans, and strips, you
|
For each major primitive type: points, triangles, fans, and strips, you
|
||||||
can specify an index list of vertices, normals, colors, and texture
|
can specify an index list of vertices, normals, colors, and texture
|
||||||
coordinates. You can skip any of these you like to save on space.
|
coordinates. You can skip any of these you like to save on space.
|
||||||
* Added support for new file features in the binary -> ascii scenery file
|
* Added support for new file features in the binary -> ascii scenery file
|
||||||
@@ -235,7 +302,7 @@ New in 0.0.17pre1
|
|||||||
|
|
||||||
New in 0.0.16
|
New in 0.0.16
|
||||||
* July 12, 2001
|
* July 12, 2001
|
||||||
* Various changes to the property manager implimentation to better support
|
* Various changes to the property manager implementation to better support
|
||||||
dumping out the desired portions of the property tree to file.
|
dumping out the desired portions of the property tree to file.
|
||||||
* Don't compile the metakit demos by default (causes problems for Irix)'
|
* Don't compile the metakit demos by default (causes problems for Irix)'
|
||||||
* Other various tweaks for Irix.
|
* Other various tweaks for Irix.
|
||||||
@@ -278,7 +345,7 @@ New in 0.0.15
|
|||||||
read/write routines.
|
read/write routines.
|
||||||
* Added doxygen comments for all public interface code. Documentation
|
* Added doxygen comments for all public interface code. Documentation
|
||||||
can be accessed via the SimGear web page.
|
can be accessed via the SimGear web page.
|
||||||
* Many FG -> SG name space changes for better consistancy throughout
|
* Many FG -> SG name space changes for better consistency throughout
|
||||||
this package.
|
this package.
|
||||||
* Added property aliases, repeated name tags, and a general xml
|
* Added property aliases, repeated name tags, and a general xml
|
||||||
inclusion facilities. Many other property manager clean ups
|
inclusion facilities. Many other property manager clean ups
|
||||||
@@ -369,4 +436,4 @@ New in 0.0.4
|
|||||||
|
|
||||||
|
|
||||||
New in 0.0.3
|
New in 0.0.3
|
||||||
* Release that conincides with FlightGear-0.7.2
|
* Release that coincides with FlightGear-0.7.2
|
||||||
|
|||||||
-24
@@ -1,24 +0,0 @@
|
|||||||
This document describes how to build SimGear using the supplied workspace and
|
|
||||||
project files.
|
|
||||||
|
|
||||||
Unpack the SimGear source file into your work directory. This creates a new
|
|
||||||
subdirectory called SimGear-X.Y.Z. Rename this to SimGear. Before we can
|
|
||||||
build SimGear you must unpack and build the third party libraries metakit and
|
|
||||||
zlib. Sources for these are included in the SimGear/src-libs directory.
|
|
||||||
Unpack these into the top level SimGear directory. At this point your
|
|
||||||
directory structure should look something like this:
|
|
||||||
|
|
||||||
<work_dir>/
|
|
||||||
SimGear/
|
|
||||||
metakit-x.y.z/
|
|
||||||
simgear/
|
|
||||||
src-libs/
|
|
||||||
zlib-x.y.z/
|
|
||||||
|
|
||||||
Now open the SimGear workspace. This workspace file contains projects for
|
|
||||||
building metakit(mklib), SimGear and zlib. Select each project as the active
|
|
||||||
project and build all. Order is unimportant since there are no dependencies
|
|
||||||
between the projects.
|
|
||||||
|
|
||||||
The workspace and project files are generated by a perl script with extra
|
|
||||||
input from the am2dsp.cfg file.
|
|
||||||
+27
@@ -0,0 +1,27 @@
|
|||||||
|
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||||
|
|
||||||
|
You *must* have OpenSceneGraph (OSG) installed to build this version of
|
||||||
|
FlightGear.
|
||||||
|
|
||||||
|
Notice that FlightGear 1.9.0 requires at least version 2.7.8. Using earlier
|
||||||
|
versions of OSG will yield serious rendering bugs.
|
||||||
|
|
||||||
|
You can get the latest version of OSG from:
|
||||||
|
|
||||||
|
http://www.openscenegraph.org/
|
||||||
|
|
||||||
|
Build notes:
|
||||||
|
|
||||||
|
Unzip the file OpenSceneGraph-x.x.zip and install using the following
|
||||||
|
commands:
|
||||||
|
|
||||||
|
unzip OpenSceneGraph-x.x
|
||||||
|
cd OpenSceneGraph
|
||||||
|
ccmake .
|
||||||
|
|
||||||
|
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
||||||
|
then press 'g' to generate and exit ]
|
||||||
|
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
+21
-4
@@ -3,10 +3,27 @@
|
|||||||
You *must* have the development components of OpenAL installed on your system
|
You *must* have the development components of OpenAL installed on your system
|
||||||
to build FlightGear!" You can get a copy here:
|
to build FlightGear!" You can get a copy here:
|
||||||
|
|
||||||
http://www.openal.org
|
http://connect.creativelabs.com/openal/default.aspx
|
||||||
|
|
||||||
Build notes:
|
Build notes:
|
||||||
|
|
||||||
The OpenAL developers do not make "versioned" releases so we recommend that
|
You can download a versioned release of the openal library from
|
||||||
you pull the latest version via anonymous CVS (follow the instructions at
|
http://www.openal.org/downloads.html. Download the openal source,
|
||||||
the OpenAL web site) and build/install that.
|
release 0.0.8 (dated February 11, 2006) and run:
|
||||||
|
tar xjvf openal-soft-1.5.304.tar.bz2
|
||||||
|
cd openal-soft-1.5.304/
|
||||||
|
ccmake .
|
||||||
|
|
||||||
|
[ While running ccmake: press 'c' to configure, press 'c' once more, and
|
||||||
|
then press 'g' to generate and exit ]
|
||||||
|
|
||||||
|
|
||||||
|
The alut library is also required, but comes separately in the package
|
||||||
|
freelut-1.1.0.tar.gz. This package can be downloaded from the same page
|
||||||
|
(http://connect.creativelabs.com/openal/default.aspx). Download and run:
|
||||||
|
tar xzvf freelut-1.1.0.tar.gz
|
||||||
|
cd freealut-1.1.0
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
sudo make install
|
||||||
|
|
||||||
|
|||||||
+17
-1
@@ -1,6 +1,6 @@
|
|||||||
[This file is mirrored in both the FlightGear and SimGear packages.]
|
[This file is mirrored in both the FlightGear and SimGear packages.]
|
||||||
|
|
||||||
You *must* have plib version 1.6.0 or later installed on your system
|
You *must* have plib version 1.8.5 or later installed on your system
|
||||||
to build FlightGear!" Flight Gear is no longer compatible with the
|
to build FlightGear!" Flight Gear is no longer compatible with the
|
||||||
earlier versions of the library.
|
earlier versions of the library.
|
||||||
|
|
||||||
@@ -14,3 +14,19 @@ You should be able to just run "./configure" to configure the package
|
|||||||
and use all of plib's defaults. Then run "make" followed by "make
|
and use all of plib's defaults. Then run "make" followed by "make
|
||||||
install". By default, plib installs itself into /usr so if you don't
|
install". By default, plib installs itself into /usr so if you don't
|
||||||
like this, be sure to specify an alternate prefix such as --prefix=/usr/local
|
like this, be sure to specify an alternate prefix such as --prefix=/usr/local
|
||||||
|
|
||||||
|
As of this writing (2007-11-18), many linux distributions are shipped with a
|
||||||
|
working version of plib, so chances are that this library is already
|
||||||
|
installed. It should be noted, that currently plib version no longer compiles
|
||||||
|
using recent versions of gcc (confirmed on version gcc 4.1.2, as shipped with
|
||||||
|
SuSe 10.2). As a workaround, it is possible to either use plib SVN. Run the
|
||||||
|
following commands:
|
||||||
|
|
||||||
|
|
||||||
|
svn co https://plib.svn.sourceforge.net/svnroot/plib/trunk plib
|
||||||
|
cd plib
|
||||||
|
./autogen.sh
|
||||||
|
./configure
|
||||||
|
make
|
||||||
|
make install
|
||||||
|
|
||||||
|
|||||||
+5
-170
@@ -1,173 +1,8 @@
|
|||||||
For your convenience and allowed by zlib's license terms:
|
zlib is prerequisite for compiling SimGear and FlightGear. You can fetch
|
||||||
http://www.gzip.org/zlib/zlib_license.html a copy of the zlib source
|
the latest version of zlib from:
|
||||||
is bundled with SimGear in $(top_srcdir)/src-libs/. You must have
|
|
||||||
zlib installed before you can build SimGear.
|
|
||||||
|
|
||||||
- Most linux distributions have a zlib package. For linux
|
http://www.zlib.net
|
||||||
developers, we recommend ysou install your distributions package
|
|
||||||
rather than building from source.
|
|
||||||
|
|
||||||
- Cygwin installs zlib automatically.
|
Most modern unix distributions (and cygwin) come with a version of zlib
|
||||||
|
already installed or available to install as a package.
|
||||||
|
|
||||||
- For developers on most other platforms, you will have to build
|
|
||||||
zlib from source and install it yourself. For your convenience a
|
|
||||||
tar ball of the zlib source is included with the simgear source
|
|
||||||
distribution. Untar the zlib source, and follow the included
|
|
||||||
build and installation instructions.
|
|
||||||
|
|
||||||
Once zlib is installed you can return to configuring and building
|
|
||||||
Simgear.
|
|
||||||
|
|
||||||
We now send you to the official zlib README ...
|
|
||||||
|
|
||||||
|
|
||||||
=============================================================================
|
|
||||||
|
|
||||||
|
|
||||||
zlib 1.1.4 is a general purpose data compression library. All the code
|
|
||||||
is thread safe. The data format used by the zlib library
|
|
||||||
is described by RFCs (Request for Comments) 1950 to 1952 in the files
|
|
||||||
http://www.ietf.org/rfc/rfc1950.txt (zlib format), rfc1951.txt (deflate
|
|
||||||
format) and rfc1952.txt (gzip format). These documents are also available in
|
|
||||||
other formats from ftp://ftp.uu.net/graphics/png/documents/zlib/zdoc-index.html
|
|
||||||
|
|
||||||
All functions of the compression library are documented in the file zlib.h
|
|
||||||
(volunteer to write man pages welcome, contact jloup@gzip.org). A usage
|
|
||||||
example of the library is given in the file example.c which also tests that
|
|
||||||
the library is working correctly. Another example is given in the file
|
|
||||||
minigzip.c. The compression library itself is composed of all source files
|
|
||||||
except example.c and minigzip.c.
|
|
||||||
|
|
||||||
To compile all files and run the test program, follow the instructions
|
|
||||||
given at the top of Makefile. In short "make test; make install"
|
|
||||||
should work for most machines. For Unix: "./configure; make test; make install"
|
|
||||||
For MSDOS, use one of the special makefiles such as Makefile.msc.
|
|
||||||
For VMS, use Make_vms.com or descrip.mms.
|
|
||||||
|
|
||||||
Questions about zlib should be sent to <zlib@gzip.org>, or to
|
|
||||||
Gilles Vollant <info@winimage.com> for the Windows DLL version.
|
|
||||||
The zlib home page is http://www.zlib.org or http://www.gzip.org/zlib/
|
|
||||||
Before reporting a problem, please check this site to verify that
|
|
||||||
you have the latest version of zlib; otherwise get the latest version and
|
|
||||||
check whether the problem still exists or not.
|
|
||||||
|
|
||||||
PLEASE read the zlib FAQ http://www.gzip.org/zlib/zlib_faq.html
|
|
||||||
before asking for help.
|
|
||||||
|
|
||||||
Mark Nelson <markn@ieee.org> wrote an article about zlib for the Jan. 1997
|
|
||||||
issue of Dr. Dobb's Journal; a copy of the article is available in
|
|
||||||
http://dogma.net/markn/articles/zlibtool/zlibtool.htm
|
|
||||||
|
|
||||||
The changes made in version 1.1.4 are documented in the file ChangeLog.
|
|
||||||
The only changes made since 1.1.3 are bug corrections:
|
|
||||||
|
|
||||||
- ZFREE was repeated on same allocation on some error conditions.
|
|
||||||
This creates a security problem described in
|
|
||||||
http://www.zlib.org/advisory-2002-03-11.txt
|
|
||||||
- Returned incorrect error (Z_MEM_ERROR) on some invalid data
|
|
||||||
- Avoid accesses before window for invalid distances with inflate window
|
|
||||||
less than 32K.
|
|
||||||
- force windowBits > 8 to avoid a bug in the encoder for a window size
|
|
||||||
of 256 bytes. (A complete fix will be available in 1.1.5).
|
|
||||||
|
|
||||||
The beta version 1.1.5beta includes many more changes. A new official
|
|
||||||
version 1.1.5 will be released as soon as extensive testing has been
|
|
||||||
completed on it.
|
|
||||||
|
|
||||||
|
|
||||||
Unsupported third party contributions are provided in directory "contrib".
|
|
||||||
|
|
||||||
A Java implementation of zlib is available in the Java Development Kit
|
|
||||||
http://www.javasoft.com/products/JDK/1.1/docs/api/Package-java.util.zip.html
|
|
||||||
See the zlib home page http://www.zlib.org for details.
|
|
||||||
|
|
||||||
A Perl interface to zlib written by Paul Marquess <pmarquess@bfsec.bt.co.uk>
|
|
||||||
is in the CPAN (Comprehensive Perl Archive Network) sites
|
|
||||||
http://www.cpan.org/modules/by-module/Compress/
|
|
||||||
|
|
||||||
A Python interface to zlib written by A.M. Kuchling <amk@magnet.com>
|
|
||||||
is available in Python 1.5 and later versions, see
|
|
||||||
http://www.python.org/doc/lib/module-zlib.html
|
|
||||||
|
|
||||||
A zlib binding for TCL written by Andreas Kupries <a.kupries@westend.com>
|
|
||||||
is availlable at http://www.westend.com/~kupries/doc/trf/man/man.html
|
|
||||||
|
|
||||||
An experimental package to read and write files in .zip format,
|
|
||||||
written on top of zlib by Gilles Vollant <info@winimage.com>, is
|
|
||||||
available at http://www.winimage.com/zLibDll/unzip.html
|
|
||||||
and also in the contrib/minizip directory of zlib.
|
|
||||||
|
|
||||||
|
|
||||||
Notes for some targets:
|
|
||||||
|
|
||||||
- To build a Windows DLL version, include in a DLL project zlib.def, zlib.rc
|
|
||||||
and all .c files except example.c and minigzip.c; compile with -DZLIB_DLL
|
|
||||||
The zlib DLL support was initially done by Alessandro Iacopetti and is
|
|
||||||
now maintained by Gilles Vollant <info@winimage.com>. Check the zlib DLL
|
|
||||||
home page at http://www.winimage.com/zLibDll
|
|
||||||
|
|
||||||
From Visual Basic, you can call the DLL functions which do not take
|
|
||||||
a structure as argument: compress, uncompress and all gz* functions.
|
|
||||||
See contrib/visual-basic.txt for more information, or get
|
|
||||||
http://www.tcfb.com/dowseware/cmp-z-it.zip
|
|
||||||
|
|
||||||
- For 64-bit Irix, deflate.c must be compiled without any optimization.
|
|
||||||
With -O, one libpng test fails. The test works in 32 bit mode (with
|
|
||||||
the -n32 compiler flag). The compiler bug has been reported to SGI.
|
|
||||||
|
|
||||||
- zlib doesn't work with gcc 2.6.3 on a DEC 3000/300LX under OSF/1 2.1
|
|
||||||
it works when compiled with cc.
|
|
||||||
|
|
||||||
- on Digital Unix 4.0D (formely OSF/1) on AlphaServer, the cc option -std1
|
|
||||||
is necessary to get gzprintf working correctly. This is done by configure.
|
|
||||||
|
|
||||||
- zlib doesn't work on HP-UX 9.05 with some versions of /bin/cc. It works
|
|
||||||
with other compilers. Use "make test" to check your compiler.
|
|
||||||
|
|
||||||
- gzdopen is not supported on RISCOS, BEOS and by some Mac compilers.
|
|
||||||
|
|
||||||
- For Turbo C the small model is supported only with reduced performance to
|
|
||||||
avoid any far allocation; it was tested with -DMAX_WBITS=11 -DMAX_MEM_LEVEL=3
|
|
||||||
|
|
||||||
- For PalmOs, see http://www.cs.uit.no/~perm/PASTA/pilot/software.html
|
|
||||||
Per Harald Myrvang <perm@stud.cs.uit.no>
|
|
||||||
|
|
||||||
|
|
||||||
Acknowledgments:
|
|
||||||
|
|
||||||
The deflate format used by zlib was defined by Phil Katz. The deflate
|
|
||||||
and zlib specifications were written by L. Peter Deutsch. Thanks to all the
|
|
||||||
people who reported problems and suggested various improvements in zlib;
|
|
||||||
they are too numerous to cite here.
|
|
||||||
|
|
||||||
Copyright notice:
|
|
||||||
|
|
||||||
(C) 1995-2002 Jean-loup Gailly and Mark Adler
|
|
||||||
|
|
||||||
This software is provided 'as-is', without any express or implied
|
|
||||||
warranty. In no event will the authors be held liable for any damages
|
|
||||||
arising from the use of this software.
|
|
||||||
|
|
||||||
Permission is granted to anyone to use this software for any purpose,
|
|
||||||
including commercial applications, and to alter it and redistribute it
|
|
||||||
freely, subject to the following restrictions:
|
|
||||||
|
|
||||||
1. The origin of this software must not be misrepresented; you must not
|
|
||||||
claim that you wrote the original software. If you use this software
|
|
||||||
in a product, an acknowledgment in the product documentation would be
|
|
||||||
appreciated but is not required.
|
|
||||||
2. Altered source versions must be plainly marked as such, and must not be
|
|
||||||
misrepresented as being the original software.
|
|
||||||
3. This notice may not be removed or altered from any source distribution.
|
|
||||||
|
|
||||||
Jean-loup Gailly Mark Adler
|
|
||||||
jloup@gzip.org madler@alumni.caltech.edu
|
|
||||||
|
|
||||||
If you use the zlib library in a product, we would appreciate *not*
|
|
||||||
receiving lengthy legal documents to sign. The sources are provided
|
|
||||||
for free but without warranty of any kind. The library has been
|
|
||||||
entirely written by Jean-loup Gailly and Mark Adler; it does not
|
|
||||||
include third-party code.
|
|
||||||
|
|
||||||
If you redistribute modified sources, we would appreciate that you include
|
|
||||||
in the file ChangeLog history information documenting your changes.
|
|
||||||
|
|||||||
-2889
File diff suppressed because it is too large
Load Diff
-53
@@ -1,53 +0,0 @@
|
|||||||
Microsoft Developer Studio Workspace File, Format Version 6.00
|
|
||||||
# WARNING: DO NOT EDIT OR DELETE THIS WORKSPACE FILE!
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "SimGear"=".\SimGear.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "mklib"=".\SimGear\metakit-2.4.3\win\msvc60\mklib.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Project: "zlib"=".\SimGear\zlib.dsp" - Package Owner=<4>
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<4>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
Global:
|
|
||||||
|
|
||||||
Package=<5>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
Package=<3>
|
|
||||||
{{{
|
|
||||||
}}}
|
|
||||||
|
|
||||||
###############################################################################
|
|
||||||
|
|
||||||
@@ -47,6 +47,18 @@ Jean-Francois Doue
|
|||||||
http://www.animats.com/simpleppp/ftp/public_html/topics/developers.html
|
http://www.animats.com/simpleppp/ftp/public_html/topics/developers.html
|
||||||
|
|
||||||
|
|
||||||
|
Melchior Franz
|
||||||
|
METAR parser and fetcher. "material" animation (based on Jim Wilsons's
|
||||||
|
"emission" animation). Debugging and extension of property listener
|
||||||
|
features. Addition of removeChildren.
|
||||||
|
|
||||||
|
|
||||||
|
Mathias Froehlich
|
||||||
|
Reworked and cleaned up large parts of the infrastructure, of math
|
||||||
|
files, animations and rendering in preparation of a transition to
|
||||||
|
the OSG library. Added new handlers for shared and referenced objects.
|
||||||
|
|
||||||
|
|
||||||
Bruce Finney <bfinney@gte.net>
|
Bruce Finney <bfinney@gte.net>
|
||||||
MSVC5 compatibility.
|
MSVC5 compatibility.
|
||||||
|
|
||||||
@@ -71,6 +83,10 @@ Bruce Jackson of NASA <e.b.jackson@larc.nasa.gov>
|
|||||||
http://dcb.larc.nasa.gov/www/DCBStaff/ebj/ebj.html
|
http://dcb.larc.nasa.gov/www/DCBStaff/ebj/ebj.html
|
||||||
|
|
||||||
|
|
||||||
|
Maik Justus
|
||||||
|
Fixed an old bug in the SGPropertyNode class.
|
||||||
|
|
||||||
|
|
||||||
Richard Kaszeta <bofh@me.umn.edu>
|
Richard Kaszeta <bofh@me.umn.edu>
|
||||||
Contributed screen buffer to ppm screen shot routine.
|
Contributed screen buffer to ppm screen shot routine.
|
||||||
Rich has also helped in the early development of the Flight Gear "altitude
|
Rich has also helped in the early development of the Flight Gear "altitude
|
||||||
@@ -90,6 +106,11 @@ David Megginson <david@megginson.com>
|
|||||||
SimGear property manager/registry
|
SimGear property manager/registry
|
||||||
|
|
||||||
|
|
||||||
|
Tim Moore
|
||||||
|
Ported the (chrome) "shader" animation to OSG, and helped with porting
|
||||||
|
the "material" animation.
|
||||||
|
|
||||||
|
|
||||||
Curt Olson http://www.flightgear.org/~curt/
|
Curt Olson http://www.flightgear.org/~curt/
|
||||||
Curt is responsible for overall project and source code management.
|
Curt is responsible for overall project and source code management.
|
||||||
He has his hands in many of the areas.
|
He has his hands in many of the areas.
|
||||||
@@ -99,7 +120,7 @@ Petter Reinholdtsen <pere@games.no>
|
|||||||
Incorporated the Gnu automake/autoconf system (with libtool).
|
Incorporated the Gnu automake/autoconf system (with libtool).
|
||||||
This should streamline and standardize the build process for all
|
This should streamline and standardize the build process for all
|
||||||
Unix-like platforms. It should have little effect on IDE type
|
Unix-like platforms. It should have little effect on IDE type
|
||||||
environments since the don't use the Unix make system.
|
environments since these don't use the Unix make system.
|
||||||
|
|
||||||
|
|
||||||
Paul Schlyter <pausch@saaf.se>
|
Paul Schlyter <pausch@saaf.se>
|
||||||
|
|||||||
+357
-66
@@ -3,59 +3,68 @@ dnl originally from ncftp 2.3.0
|
|||||||
dnl added wi_EXTRA_PDIR and wi_ANSI_C
|
dnl added wi_EXTRA_PDIR and wi_ANSI_C
|
||||||
dnl $Id$
|
dnl $Id$
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_EXTRA_IDIR, [
|
AC_DEFUN([wi_EXTRA_IDIR], [
|
||||||
incdir="$1"
|
incdir="$1"
|
||||||
if test -r $incdir ; then
|
if test -r $incdir ; then
|
||||||
case "$CPPFLAGS" in
|
already=""
|
||||||
*-I${incdir}*)
|
for CPPflag in $CPPFLAGS ; do
|
||||||
# echo " + already had $incdir" 1>&6
|
if test "_$CPPflag" = "_-I${incdir}" ; then
|
||||||
;;
|
already=yes
|
||||||
*)
|
break
|
||||||
if test "$CPPFLAGS" = "" ; then
|
fi
|
||||||
CPPFLAGS="-I$incdir"
|
done
|
||||||
else
|
if test -n "$already" ; then
|
||||||
CPPFLAGS="$CPPFLAGS -I$incdir"
|
echo " + already had -I$incdir" 1>&AS_MESSAGE_LOG_FD
|
||||||
fi
|
else
|
||||||
echo " + found $incdir" 1>&6
|
if test "$CPPFLAGS" = "" ; then
|
||||||
;;
|
CPPFLAGS="-I$incdir"
|
||||||
esac
|
else
|
||||||
|
CPPFLAGS="$CPPFLAGS -I$incdir"
|
||||||
|
fi
|
||||||
|
echo " + added -I$incdir" 1>&AS_MESSAGE_LOG_FD
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " + IDIR is not accessible: '$myincdir'" 1>&AS_MESSAGE_LOG_FD
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_EXTRA_LDIR, [
|
AC_DEFUN([wi_EXTRA_LDIR], [
|
||||||
mylibdir="$1"
|
mylibdir="$1"
|
||||||
if test -r $mylibdir ; then
|
if test -r $mylibdir ; then
|
||||||
case "$LDFLAGS" in
|
already=""
|
||||||
*-L${mylibdir}*)
|
for LDflag in $LDFLAGS ; do
|
||||||
# echo " + already had $mylibdir" 1>&6
|
if test "_$LDflag" = "_-L${mylibdir}" ; then
|
||||||
;;
|
already=yes
|
||||||
*)
|
break
|
||||||
if test "$LDFLAGS" = "" ; then
|
fi
|
||||||
LDFLAGS="-L$mylibdir"
|
done
|
||||||
else
|
if test -n "$already" ; then
|
||||||
LDFLAGS="$LDFLAGS -L$mylibdir"
|
echo " + already had -L$mylibdir" 1>&AS_MESSAGE_LOG_FD
|
||||||
fi
|
else
|
||||||
echo " + found $mylibdir" 1>&6
|
if test "$LDFLAGS" = "" ; then
|
||||||
;;
|
LDFLAGS="-L$mylibdir"
|
||||||
esac
|
else
|
||||||
|
LDFLAGS="$LDFLAGS -L$mylibdir"
|
||||||
|
fi
|
||||||
|
echo " + added -L$mylibdir" 1>&AS_MESSAGE_LOG_FD
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo " + LDIR is not accessible: '$mylibdir'" 1>&AS_MESSAGE_LOG_FD
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
dnl
|
dnl
|
||||||
dnl __FP__
|
dnl __FP__
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_EXTRA_PDIR, [
|
AC_DEFUN([wi_EXTRA_PDIR], [
|
||||||
progdir="$1"
|
progdir="$1"
|
||||||
if test -r $progdir ; then
|
if test -r $progdir ; then
|
||||||
case "$PATH" in
|
case ":$PATH:" in
|
||||||
*:${progdir}*)
|
*:${progdir}:*)
|
||||||
# echo " + already had $progdir" 1>&6
|
echo " + already had $progdir in \$PATH" 1>&AS_MESSAGE_LOG_FD
|
||||||
;;
|
|
||||||
*${progdir}:*)
|
|
||||||
# echo " + already had $progdir" 1>&6
|
|
||||||
;;
|
;;
|
||||||
*)
|
*)
|
||||||
if test "$PATH" = "" ; then
|
if test "$PATH" = "" ; then
|
||||||
@@ -63,9 +72,11 @@ if test -r $progdir ; then
|
|||||||
else
|
else
|
||||||
PATH="$PATH:$progdir"
|
PATH="$PATH:$progdir"
|
||||||
fi
|
fi
|
||||||
echo " + found $progdir" 1>&6
|
echo " + appended $progdir to \$PATH" 1>&AS_MESSAGE_LOG_FD
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
else
|
||||||
|
echo " + PDIR is not accessible: '$progdir'" 1>&AS_MESSAGE_LOG_FD
|
||||||
fi
|
fi
|
||||||
])
|
])
|
||||||
dnl
|
dnl
|
||||||
@@ -76,7 +87,7 @@ dnl
|
|||||||
dnl If you want to look for subdirectories in include/lib directories,
|
dnl If you want to look for subdirectories in include/lib directories,
|
||||||
dnl you pass the names in argument 3, otherwise pass a dash.
|
dnl you pass the names in argument 3, otherwise pass a dash.
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_EXTRA_DIRS, [echo "checking for extra include and lib directories..." 1>&6
|
AC_DEFUN([wi_EXTRA_DIRS], [echo "checking for extra include and lib directories..." 1>&6
|
||||||
ifelse([$1], yes, [dnl
|
ifelse([$1], yes, [dnl
|
||||||
b1=`cd .. ; pwd`
|
b1=`cd .. ; pwd`
|
||||||
b2=`cd ../.. ; pwd`
|
b2=`cd ../.. ; pwd`
|
||||||
@@ -89,29 +100,38 @@ if test "$subexdirs" = "" ; then
|
|||||||
subexdirs="-"
|
subexdirs="-"
|
||||||
fi
|
fi
|
||||||
for subexdir in $subexdirs ; do
|
for subexdir in $subexdirs ; do
|
||||||
if test "$subexdir" = "-" ; then
|
if test "$subexdir" = "-" ; then
|
||||||
subexdir=""
|
subexdir=""
|
||||||
else
|
else
|
||||||
subexdir="/$subexdir"
|
subexdir="/$subexdir"
|
||||||
fi
|
fi
|
||||||
for exdir in $exdirs ; do
|
for exdir in $exdirs ; do
|
||||||
if test "$exdir" != "/usr" || test "$subexdir" != ""; then
|
if test "$exdir" != "/usr" || test "$subexdir" != ""; then
|
||||||
incdir="${exdir}/include${subexdir}"
|
incdir="${exdir}/include${subexdir}"
|
||||||
wi_EXTRA_IDIR($incdir)
|
wi_EXTRA_IDIR($incdir)
|
||||||
|
|
||||||
mylibdir="${exdir}/lib${subexdir}"
|
dnl On 64-bit machines, if lib64/ exists and is not identical to lib/
|
||||||
wi_EXTRA_LDIR($mylibdir)
|
dnl then it should be listed here, listed ahead of lib/.
|
||||||
|
mylibdir64="${exdir}/lib64${subexdir}"
|
||||||
|
mylibdir32="${exdir}/lib${subexdir}"
|
||||||
|
|
||||||
progdir="${exdir}/bin${subexdir}"
|
if test "x86_64" = $(uname -m) \
|
||||||
wi_EXTRA_PDIR($progdir)
|
-a ! ${mylibdir64} -ef ${mylibdir32} ; then
|
||||||
fi
|
wi_EXTRA_LDIR($mylibdir64)
|
||||||
done
|
fi
|
||||||
|
|
||||||
|
wi_EXTRA_LDIR($mylibdir32)
|
||||||
|
|
||||||
|
progdir="${exdir}/bin${subexdir}"
|
||||||
|
wi_EXTRA_PDIR($progdir)
|
||||||
|
fi
|
||||||
|
done
|
||||||
done
|
done
|
||||||
])
|
])
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_HPUX_CFLAGS,
|
AC_DEFUN([wi_HPUX_CFLAGS],
|
||||||
[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
|
[AC_MSG_CHECKING(if HP-UX ansi C compiler flags are needed)
|
||||||
AC_REQUIRE([AC_PROG_CC])
|
AC_REQUIRE([AC_PROG_CC])
|
||||||
os=`uname -s | tr '[A-Z]' '[a-z]'`
|
os=`uname -s | tr '[A-Z]' '[a-z]'`
|
||||||
@@ -144,7 +164,7 @@ AC_MSG_RESULT($ac_cv_hpux_flags)
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_CFLAGS, [AC_REQUIRE([AC_PROG_CC])
|
AC_DEFUN([wi_CFLAGS], [AC_REQUIRE([AC_PROG_CC])
|
||||||
wi_HPUX_CFLAGS
|
wi_HPUX_CFLAGS
|
||||||
if test "$CFLAGS" = "" ; then
|
if test "$CFLAGS" = "" ; then
|
||||||
CFLAGS="-O"
|
CFLAGS="-O"
|
||||||
@@ -165,7 +185,7 @@ wi_HPUX_CFLAGS
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_PROTOTYPES, [
|
AC_DEFUN([wi_PROTOTYPES], [
|
||||||
AC_MSG_CHECKING(if the compiler supports function prototypes)
|
AC_MSG_CHECKING(if the compiler supports function prototypes)
|
||||||
AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
|
AC_TRY_COMPILE(,[extern void exit(int status);],[wi_cv_prototypes=yes
|
||||||
AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
|
AC_DEFINE(PROTOTYPES)],wi_cv_prototypes=no)
|
||||||
@@ -174,7 +194,7 @@ AC_MSG_RESULT($wi_cv_prototypes)
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_ANSI_C, [
|
AC_DEFUN([wi_ANSI_C], [
|
||||||
AC_MSG_CHECKING(ANSI-style function definitions)
|
AC_MSG_CHECKING(ANSI-style function definitions)
|
||||||
AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes
|
AC_TRY_COMPILE(,[int blubb(int x) { return 0; }],[wi_cv_ansi_funcs=yes
|
||||||
AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no)
|
AC_DEFINE(ANSI_FUNCS)],wi_cv_ansi_funcs=no)
|
||||||
@@ -183,7 +203,7 @@ AC_MSG_RESULT($wi_cv_ansi_funcs)
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_HEADER_SYS_SELECT_H, [
|
AC_DEFUN([wi_HEADER_SYS_SELECT_H], [
|
||||||
# See if <sys/select.h> is includable after <sys/time.h>
|
# See if <sys/select.h> is includable after <sys/time.h>
|
||||||
if test "$ac_cv_header_sys_time_h" = no ; then
|
if test "$ac_cv_header_sys_time_h" = no ; then
|
||||||
AC_CHECK_HEADERS(sys/time.h sys/select.h)
|
AC_CHECK_HEADERS(sys/time.h sys/select.h)
|
||||||
@@ -211,7 +231,7 @@ fi
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_LIB_RESOLV, [
|
AC_DEFUN([wi_LIB_RESOLV], [
|
||||||
# See if we could access two well-known sites without help of any special
|
# See if we could access two well-known sites without help of any special
|
||||||
# libraries, like resolv.
|
# libraries, like resolv.
|
||||||
|
|
||||||
@@ -244,7 +264,7 @@ dnl
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_DEFUN(wi_LIB_NSL, [
|
AC_DEFUN([wi_LIB_NSL], [
|
||||||
AC_MSG_CHECKING(if we can use -lnsl)
|
AC_MSG_CHECKING(if we can use -lnsl)
|
||||||
ac_save_LIBS="$LIBS";
|
ac_save_LIBS="$LIBS";
|
||||||
LIBS="$LIBS -lnsl";
|
LIBS="$LIBS -lnsl";
|
||||||
@@ -261,7 +281,7 @@ dnl
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
|
|
||||||
AC_DEFUN(nc_PATH_PROG_ZCAT, [
|
AC_DEFUN([nc_PATH_PROG_ZCAT], [
|
||||||
AC_PATH_PROG(GZCAT,gzcat)
|
AC_PATH_PROG(GZCAT,gzcat)
|
||||||
AC_PATH_PROG(ZCAT,zcat)
|
AC_PATH_PROG(ZCAT,zcat)
|
||||||
if test "x$GZCAT" = x ; then
|
if test "x$GZCAT" = x ; then
|
||||||
@@ -287,7 +307,7 @@ fi
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_SYSV_EXTRA_DIRS, [
|
AC_DEFUN([wi_SYSV_EXTRA_DIRS], [
|
||||||
# Use System V because their curses extensions are required. This must
|
# Use System V because their curses extensions are required. This must
|
||||||
# be done early so we use the -I and -L in the library checks also.
|
# be done early so we use the -I and -L in the library checks also.
|
||||||
# This is mostly a Solaris/SunOS hack. Note that doing this will also
|
# This is mostly a Solaris/SunOS hack. Note that doing this will also
|
||||||
@@ -305,7 +325,7 @@ fi
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_DEFINE_UNAME, [
|
AC_DEFUN([wi_DEFINE_UNAME], [
|
||||||
# Get first 127 chars of all uname information. Some folks have
|
# Get first 127 chars of all uname information. Some folks have
|
||||||
# way too much stuff there, so grab only the first 127.
|
# way too much stuff there, so grab only the first 127.
|
||||||
unam=`uname -a 2>/dev/null | cut -c1-127`
|
unam=`uname -a 2>/dev/null | cut -c1-127`
|
||||||
@@ -316,7 +336,7 @@ fi
|
|||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
dnl
|
dnl
|
||||||
AC_DEFUN(wi_READLINE_WITH_NCURSES, [
|
AC_DEFUN([wi_READLINE_WITH_NCURSES], [
|
||||||
# Readline and Ncurses could both define "backspace".
|
# Readline and Ncurses could both define "backspace".
|
||||||
# Warn about this if we have both things in our definitions list.
|
# Warn about this if we have both things in our definitions list.
|
||||||
|
|
||||||
@@ -352,7 +372,7 @@ dnl
|
|||||||
|
|
||||||
dnl AC_EXT_DAYLIGHT
|
dnl AC_EXT_DAYLIGHT
|
||||||
dnl Check for an external variable daylight. Stolen from w3c-libwww.
|
dnl Check for an external variable daylight. Stolen from w3c-libwww.
|
||||||
AC_DEFUN(AC_EXT_DAYLIGHT,
|
AC_DEFUN([AC_EXT_DAYLIGHT],
|
||||||
[ AC_MSG_CHECKING(int daylight variable)
|
[ AC_MSG_CHECKING(int daylight variable)
|
||||||
AC_TRY_COMPILE([#include <time.h>], [return daylight;],
|
AC_TRY_COMPILE([#include <time.h>], [return daylight;],
|
||||||
have_daylight=yes,
|
have_daylight=yes,
|
||||||
@@ -362,7 +382,7 @@ AC_MSG_RESULT($have_daylight)
|
|||||||
|
|
||||||
dnl AC_EXT_TIMEZONE
|
dnl AC_EXT_TIMEZONE
|
||||||
dnl Check for an external variable timezone. Stolen from tcl-8.0.
|
dnl Check for an external variable timezone. Stolen from tcl-8.0.
|
||||||
AC_DEFUN(AC_EXT_TIMEZONE,
|
AC_DEFUN([AC_EXT_TIMEZONE],
|
||||||
[
|
[
|
||||||
#
|
#
|
||||||
# Its important to include time.h in this check, as some systems (like convex)
|
# Its important to include time.h in this check, as some systems (like convex)
|
||||||
@@ -395,7 +415,7 @@ fi
|
|||||||
|
|
||||||
## AC_BZ_SET_COMPILER: Addition by Theodore Papadopoulo
|
## AC_BZ_SET_COMPILER: Addition by Theodore Papadopoulo
|
||||||
## Patch by Jim McKelvey: change sed -e 's/ /@/g' to sed -e 's/ /@/'
|
## Patch by Jim McKelvey: change sed -e 's/ /@/g' to sed -e 's/ /@/'
|
||||||
AC_DEFUN(AC_SG_SET_COMPILER,
|
AC_DEFUN([AC_SG_SET_COMPILER],
|
||||||
[cxxwith=`echo $1 | sed -e 's/ /@/'`
|
[cxxwith=`echo $1 | sed -e 's/ /@/'`
|
||||||
case "$cxxwith" in
|
case "$cxxwith" in
|
||||||
*:*@*) # Full initialization syntax
|
*:*@*) # Full initialization syntax
|
||||||
@@ -413,3 +433,274 @@ AC_DEFUN(AC_SG_SET_COMPILER,
|
|||||||
## CFLAGS=
|
## CFLAGS=
|
||||||
;;
|
;;
|
||||||
esac])
|
esac])
|
||||||
|
|
||||||
|
pushdef([AC_PROG_INSTALL],
|
||||||
|
[
|
||||||
|
dnl our own version, testing for a -p flag
|
||||||
|
popdef([AC_PROG_INSTALL])
|
||||||
|
dnl as AC_PROG_INSTALL works as it works we first have
|
||||||
|
dnl to save if the user didn't specify INSTALL, as the
|
||||||
|
dnl autoconf one overwrites INSTALL and we have no chance to find
|
||||||
|
dnl out afterwards
|
||||||
|
AC_PROG_INSTALL
|
||||||
|
|
||||||
|
# OK, user hasn't given any INSTALL, autoconf found one for us
|
||||||
|
# now we test, if it supports the -p flag
|
||||||
|
AC_MSG_CHECKING(for -p flag to install)
|
||||||
|
rm -f confinst.$$.* > /dev/null 2>&1
|
||||||
|
echo "Testtest" > confinst.$$.orig
|
||||||
|
ac_res=no
|
||||||
|
if ${INSTALL} -p confinst.$$.orig confinst.$$.new > /dev/null 2>&1 ; then
|
||||||
|
if test -f confinst.$$.new ; then
|
||||||
|
# OK, -p seems to do no harm to install
|
||||||
|
INSTALL="${INSTALL} -p"
|
||||||
|
ac_res=yes
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
rm -f confinst.$$.*
|
||||||
|
AC_MSG_RESULT($ac_res)
|
||||||
|
dnl the following tries to resolve some signs and wonders coming up
|
||||||
|
dnl with different autoconf/automake versions
|
||||||
|
dnl e.g.:
|
||||||
|
dnl *automake 1.4 install-strip sets A_M_INSTALL_PROGRAM_FLAGS to -s
|
||||||
|
dnl and has INSTALL_PROGRAM = @INSTALL_PROGRAM@ $(A_M_INSTALL_PROGRAM_FLAGS)
|
||||||
|
dnl it header-vars.am, so there the actual INSTALL_PROGRAM gets the -s
|
||||||
|
dnl *automake 1.4a (and above) use INSTALL_STRIP_FLAG and only has
|
||||||
|
dnl INSTALL_PROGRAM = @INSTALL_PROGRAM@ there, but changes the
|
||||||
|
dnl install-@DIR@PROGRAMS targets to explicitly use that flag
|
||||||
|
dnl *autoconf 2.13 is dumb, and thinks it can use INSTALL_PROGRAM as
|
||||||
|
dnl INSTALL_SCRIPT, which breaks with automake <= 1.4
|
||||||
|
dnl *autoconf >2.13 (since 10.Apr 1999) has not that failure
|
||||||
|
dnl to clean up that mess we:
|
||||||
|
dnl +set INSTALL_PROGRAM to use INSTALL_STRIP_FLAG
|
||||||
|
dnl which cleans KDE's program with automake > 1.4;
|
||||||
|
dnl +set INSTALL_SCRIPT to only use INSTALL, to clean up autoconf's problems
|
||||||
|
dnl with automake<=1.4
|
||||||
|
dnl note that dues to this sometimes two '-s' flags are used
|
||||||
|
INSTALL_PROGRAM='${INSTALL} $(INSTALL_STRIP_FLAG)'
|
||||||
|
INSTALL_SCRIPT='${INSTALL}'
|
||||||
|
])dnl
|
||||||
|
|
||||||
|
# ===========================================================================
|
||||||
|
# http://autoconf-archive.cryp.to/ax_boost_base.html
|
||||||
|
# ===========================================================================
|
||||||
|
#
|
||||||
|
# SYNOPSIS
|
||||||
|
#
|
||||||
|
# AX_BOOST_BASE([MINIMUM-VERSION])
|
||||||
|
#
|
||||||
|
# DESCRIPTION
|
||||||
|
#
|
||||||
|
# Test for the Boost C++ libraries of a particular version (or newer)
|
||||||
|
#
|
||||||
|
# If no path to the installed boost library is given the macro searchs
|
||||||
|
# under /usr, /usr/local, /opt and /opt/local and evaluates the
|
||||||
|
# $BOOST_ROOT environment variable. Further documentation is available at
|
||||||
|
# <http://randspringer.de/boost/index.html>.
|
||||||
|
#
|
||||||
|
# This macro calls:
|
||||||
|
#
|
||||||
|
# AC_SUBST(BOOST_CPPFLAGS) / AC_SUBST(BOOST_LDFLAGS)
|
||||||
|
#
|
||||||
|
# And sets:
|
||||||
|
#
|
||||||
|
# HAVE_BOOST
|
||||||
|
#
|
||||||
|
# LAST MODIFICATION
|
||||||
|
#
|
||||||
|
# 2008-04-12
|
||||||
|
#
|
||||||
|
# COPYLEFT
|
||||||
|
#
|
||||||
|
# Copyright (c) 2008 Thomas Porschberg <thomas@randspringer.de>
|
||||||
|
#
|
||||||
|
# Copying and distribution of this file, with or without modification, are
|
||||||
|
# permitted in any medium without royalty provided the copyright notice
|
||||||
|
# and this notice are preserved.
|
||||||
|
|
||||||
|
AC_DEFUN([AX_BOOST_BASE],
|
||||||
|
[
|
||||||
|
AC_ARG_WITH([boost],
|
||||||
|
AS_HELP_STRING([--with-boost@<:@=DIR@:>@], [use boost (default is yes) - it is possible to specify the root directory for boost (optional)]),
|
||||||
|
[
|
||||||
|
if test "$withval" = "no"; then
|
||||||
|
want_boost="no"
|
||||||
|
elif test "$withval" = "yes"; then
|
||||||
|
want_boost="yes"
|
||||||
|
ac_boost_path=""
|
||||||
|
else
|
||||||
|
want_boost="yes"
|
||||||
|
ac_boost_path="$withval"
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[want_boost="yes"])
|
||||||
|
|
||||||
|
|
||||||
|
AC_ARG_WITH([boost-libdir],
|
||||||
|
AS_HELP_STRING([--with-boost-libdir=LIB_DIR],
|
||||||
|
[Force given directory for boost libraries. Note that this will overwrite library path detection, so use this parameter only if default library detection fails and you know exactly where your boost libraries are located.]),
|
||||||
|
[
|
||||||
|
if test -d $withval
|
||||||
|
then
|
||||||
|
ac_boost_lib_path="$withval"
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR(--with-boost-libdir expected directory name)
|
||||||
|
fi
|
||||||
|
],
|
||||||
|
[ac_boost_lib_path=""]
|
||||||
|
)
|
||||||
|
|
||||||
|
if test "x$want_boost" = "xyes"; then
|
||||||
|
boost_lib_version_req=ifelse([$1], ,1.20.0,$1)
|
||||||
|
boost_lib_version_req_shorten=`expr $boost_lib_version_req : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||||
|
boost_lib_version_req_major=`expr $boost_lib_version_req : '\([[0-9]]*\)'`
|
||||||
|
boost_lib_version_req_minor=`expr $boost_lib_version_req : '[[0-9]]*\.\([[0-9]]*\)'`
|
||||||
|
boost_lib_version_req_sub_minor=`expr $boost_lib_version_req : '[[0-9]]*\.[[0-9]]*\.\([[0-9]]*\)'`
|
||||||
|
if test "x$boost_lib_version_req_sub_minor" = "x" ; then
|
||||||
|
boost_lib_version_req_sub_minor="0"
|
||||||
|
fi
|
||||||
|
WANT_BOOST_VERSION=`expr $boost_lib_version_req_major \* 100000 \+ $boost_lib_version_req_minor \* 100 \+ $boost_lib_version_req_sub_minor`
|
||||||
|
AC_MSG_CHECKING(for boostlib >= $boost_lib_version_req)
|
||||||
|
succeeded=no
|
||||||
|
|
||||||
|
dnl first we check the system location for boost libraries
|
||||||
|
dnl this location ist chosen if boost libraries are installed with the --layout=system option
|
||||||
|
dnl or if you install boost with RPM
|
||||||
|
if test "$ac_boost_path" != ""; then
|
||||||
|
BOOST_LDFLAGS="-L$ac_boost_path/lib"
|
||||||
|
BOOST_CPPFLAGS="-I$ac_boost_path/include"
|
||||||
|
else
|
||||||
|
for ac_boost_path_tmp in /usr /usr/local /opt /opt/local ; do
|
||||||
|
if test -d "$ac_boost_path_tmp/include/boost" && test -r "$ac_boost_path_tmp/include/boost"; then
|
||||||
|
BOOST_LDFLAGS="-L$ac_boost_path_tmp/lib"
|
||||||
|
BOOST_CPPFLAGS="-I$ac_boost_path_tmp/include"
|
||||||
|
break;
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl overwrite ld flags if we have required special directory with
|
||||||
|
dnl --with-boost-libdir parameter
|
||||||
|
if test "$ac_boost_lib_path" != ""; then
|
||||||
|
BOOST_LDFLAGS="-L$ac_boost_lib_path"
|
||||||
|
fi
|
||||||
|
|
||||||
|
CPPFLAGS_SAVED="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||||
|
export CPPFLAGS
|
||||||
|
|
||||||
|
LDFLAGS_SAVED="$LDFLAGS"
|
||||||
|
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||||
|
export LDFLAGS
|
||||||
|
|
||||||
|
AC_LANG_PUSH(C++)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
@%:@include <boost/version.hpp>
|
||||||
|
]], [[
|
||||||
|
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||||
|
// Everything is okay
|
||||||
|
#else
|
||||||
|
# error Boost version is too old
|
||||||
|
#endif
|
||||||
|
]])],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
succeeded=yes
|
||||||
|
found_system=yes
|
||||||
|
],[
|
||||||
|
])
|
||||||
|
AC_LANG_POP([C++])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
dnl if we found no boost with system layout we search for boost libraries
|
||||||
|
dnl built and installed without the --layout=system option or for a staged(not installed) version
|
||||||
|
if test "x$succeeded" != "xyes"; then
|
||||||
|
_version=0
|
||||||
|
if test "$ac_boost_path" != ""; then
|
||||||
|
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||||
|
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||||
|
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||||
|
V_CHECK=`expr $_version_tmp \> $_version`
|
||||||
|
if test "$V_CHECK" = "1" ; then
|
||||||
|
_version=$_version_tmp
|
||||||
|
fi
|
||||||
|
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||||
|
BOOST_CPPFLAGS="-I$ac_boost_path/include/boost-$VERSION_UNDERSCORE"
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
for ac_boost_path in /usr /usr/local /opt /opt/local ; do
|
||||||
|
if test -d "$ac_boost_path" && test -r "$ac_boost_path"; then
|
||||||
|
for i in `ls -d $ac_boost_path/include/boost-* 2>/dev/null`; do
|
||||||
|
_version_tmp=`echo $i | sed "s#$ac_boost_path##" | sed 's/\/include\/boost-//' | sed 's/_/./'`
|
||||||
|
V_CHECK=`expr $_version_tmp \> $_version`
|
||||||
|
if test "$V_CHECK" = "1" ; then
|
||||||
|
_version=$_version_tmp
|
||||||
|
best_path=$ac_boost_path
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
VERSION_UNDERSCORE=`echo $_version | sed 's/\./_/'`
|
||||||
|
BOOST_CPPFLAGS="-I$best_path/include/boost-$VERSION_UNDERSCORE"
|
||||||
|
if test "$ac_boost_lib_path" = ""
|
||||||
|
then
|
||||||
|
BOOST_LDFLAGS="-L$best_path/lib"
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "x$BOOST_ROOT" != "x"; then
|
||||||
|
if test -d "$BOOST_ROOT" && test -r "$BOOST_ROOT" && test -d "$BOOST_ROOT/stage/lib" && test -r "$BOOST_ROOT/stage/lib"; then
|
||||||
|
version_dir=`expr //$BOOST_ROOT : '.*/\(.*\)'`
|
||||||
|
stage_version=`echo $version_dir | sed 's/boost_//' | sed 's/_/./g'`
|
||||||
|
stage_version_shorten=`expr $stage_version : '\([[0-9]]*\.[[0-9]]*\)'`
|
||||||
|
V_CHECK=`expr $stage_version_shorten \>\= $_version`
|
||||||
|
if test "$V_CHECK" = "1" -a "$ac_boost_lib_path" = "" ; then
|
||||||
|
AC_MSG_NOTICE(We will use a staged boost library from $BOOST_ROOT)
|
||||||
|
BOOST_CPPFLAGS="-I$BOOST_ROOT"
|
||||||
|
BOOST_LDFLAGS="-L$BOOST_ROOT/stage/lib"
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||||
|
export CPPFLAGS
|
||||||
|
LDFLAGS="$LDFLAGS $BOOST_LDFLAGS"
|
||||||
|
export LDFLAGS
|
||||||
|
|
||||||
|
AC_LANG_PUSH(C++)
|
||||||
|
AC_COMPILE_IFELSE([AC_LANG_PROGRAM([[
|
||||||
|
@%:@include <boost/version.hpp>
|
||||||
|
]], [[
|
||||||
|
#if BOOST_VERSION >= $WANT_BOOST_VERSION
|
||||||
|
// Everything is okay
|
||||||
|
#else
|
||||||
|
# error Boost version is too old
|
||||||
|
#endif
|
||||||
|
]])],[
|
||||||
|
AC_MSG_RESULT(yes)
|
||||||
|
succeeded=yes
|
||||||
|
found_system=yes
|
||||||
|
],[
|
||||||
|
])
|
||||||
|
AC_LANG_POP([C++])
|
||||||
|
fi
|
||||||
|
|
||||||
|
if test "$succeeded" != "yes" ; then
|
||||||
|
if test "$_version" = "0" ; then
|
||||||
|
AC_MSG_ERROR([[We could not detect the boost libraries (version $boost_lib_version_req_shorten or higher). If you have a staged boost library (still not installed) please specify \$BOOST_ROOT in your environment and do not give a PATH to --with-boost option. If you are sure you have boost installed, then check your version number looking in <boost/version.hpp>. See http://randspringer.de/boost for more documentation.]])
|
||||||
|
else
|
||||||
|
AC_MSG_ERROR([Your boost libraries seems to old (version $_version).])
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
AC_SUBST(BOOST_CPPFLAGS)
|
||||||
|
AC_SUBST(BOOST_LDFLAGS)
|
||||||
|
AC_DEFINE(HAVE_BOOST,,[define if the Boost library is available])
|
||||||
|
fi
|
||||||
|
|
||||||
|
CPPFLAGS="$CPPFLAGS_SAVED"
|
||||||
|
LDFLAGS="$LDFLAGS_SAVED"
|
||||||
|
fi
|
||||||
|
|
||||||
|
])
|
||||||
|
|||||||
+4
-5
@@ -4,14 +4,13 @@ exclude_dir = threads
|
|||||||
include_path = .
|
include_path = .
|
||||||
include_path = ..
|
include_path = ..
|
||||||
include_path = .\SimGear
|
include_path = .\SimGear
|
||||||
include_path = .\SimGear\metakit-2.4.3\include
|
include_path = ..\zlib-1.2.3
|
||||||
include_path = ..\SimGear\zlib-1.1.4
|
include_path = "..\OpenAL 1.0 Software Development Kit\include"
|
||||||
|
|
||||||
|
define = _USE_MATH_DEFINES
|
||||||
|
define = _CRT_SECURE_NO_DEPRECATE
|
||||||
define = HAVE_CONFIG_H
|
define = HAVE_CONFIG_H
|
||||||
|
|
||||||
add_project = .\SimGear\metakit-2.4.3\win\msvc60\mklib.dsp,mklib
|
|
||||||
add_project = .\SimGear\zlib.dsp,zlib
|
|
||||||
|
|
||||||
# Rule to create simgear_config.h
|
# Rule to create simgear_config.h
|
||||||
add_source_file = SOURCE=.\simgear\simgear_config.h.vc5\
|
add_source_file = SOURCE=.\simgear\simgear_config.h.vc5\
|
||||||
\
|
\
|
||||||
|
|||||||
+258
-55
@@ -1,15 +1,17 @@
|
|||||||
dnl Process this file with autoget.sh to produce a working configure
|
dnl Process this file with autogen.sh to produce a working configure
|
||||||
dnl script.
|
dnl script.
|
||||||
|
|
||||||
AC_INIT
|
AC_INIT(SimGear, m4_esyscmd([cat ./version | tr -d '\n']), [http://www.flightgear.org])
|
||||||
|
|
||||||
|
dnl Ensure touching the version causes autoconf to re-run
|
||||||
|
AC_SUBST([CONFIGURE_DEPENDENCIES], ['$(top_srcdir)/version'])
|
||||||
|
|
||||||
AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
|
AC_CONFIG_SRCDIR([simgear/bucket/newbucket.cxx])
|
||||||
|
|
||||||
dnl Require at least automake 2.52
|
dnl Require at least automake 2.52
|
||||||
AC_PREREQ(2.52)
|
AC_PREREQ(2.52)
|
||||||
|
|
||||||
dnl Initialize the automake stuff
|
dnl Initialize the automake stuff
|
||||||
AM_INIT_AUTOMAKE(SimGear, 0.3.8)
|
|
||||||
|
|
||||||
dnl Specify KAI C++ compiler and flags.
|
dnl Specify KAI C++ compiler and flags.
|
||||||
dnl Borrowed with slight modification from blitz distribution.
|
dnl Borrowed with slight modification from blitz distribution.
|
||||||
AC_ARG_WITH(cxx,
|
AC_ARG_WITH(cxx,
|
||||||
@@ -23,18 +25,37 @@ AC_ARG_WITH(cxx,
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
])
|
])
|
||||||
|
dnl set the $host variable based on local machine/os
|
||||||
|
AC_CANONICAL_TARGET
|
||||||
|
AM_INIT_AUTOMAKE([dist-bzip2])
|
||||||
|
|
||||||
echo CXX = $CXX
|
AC_ARG_ENABLE(headless,
|
||||||
echo CC = $CC
|
AS_HELP_STRING([--enable-headless],[Enable only packages for headless build]))
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([for headless mode])
|
||||||
|
AC_MSG_RESULT([$enable_headless])
|
||||||
|
|
||||||
|
AM_CONDITIONAL(WANT_HEADLESS,[test "x$enable_headless" = "xyes"])
|
||||||
|
|
||||||
|
AC_MSG_CHECKING([CXX])
|
||||||
|
AC_MSG_RESULT([$CXX])
|
||||||
|
AC_MSG_CHECKING([CC])
|
||||||
|
AC_MSG_RESULT([$CC])
|
||||||
|
|
||||||
dnl Checks for programs.
|
dnl Checks for programs.
|
||||||
AC_PROG_MAKE_SET
|
AC_PROG_MAKE_SET
|
||||||
AC_PROG_CC
|
AC_PROG_CC
|
||||||
AC_PROG_CPP
|
AC_PROG_CPP
|
||||||
AC_PROG_CXX
|
AC_PROG_CXX
|
||||||
|
AC_PROG_CXXCPP
|
||||||
AC_PROG_RANLIB
|
AC_PROG_RANLIB
|
||||||
AC_PROG_INSTALL
|
AC_PROG_INSTALL
|
||||||
AC_PROG_LN_S
|
AC_PROG_LN_S
|
||||||
|
AX_BOOST_BASE([1.37.0])
|
||||||
|
|
||||||
|
if test "x$BOOST_CPPFLAGS" != "x-I/usr/include" ; then
|
||||||
|
CPPFLAGS="$CPPFLAGS $BOOST_CPPFLAGS"
|
||||||
|
fi
|
||||||
|
|
||||||
dnl set the $host variable based on local machine/os
|
dnl set the $host variable based on local machine/os
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
@@ -76,13 +97,17 @@ AC_SUBST(AR)
|
|||||||
AC_SUBST(ARFLAGS)
|
AC_SUBST(ARFLAGS)
|
||||||
AC_SUBST(compatibility_DIR)
|
AC_SUBST(compatibility_DIR)
|
||||||
|
|
||||||
|
# Show all compiler warnings by default
|
||||||
|
CXXFLAGS="$CXXFLAGS -Wall"
|
||||||
|
CFLAGS="$CFLAGS -Wall"
|
||||||
|
|
||||||
if echo $includedir | egrep "simgear$" > /dev/null; then
|
if echo $includedir | egrep "simgear$" > /dev/null; then
|
||||||
echo "includedir is" $includedir "libdir is" $libdir
|
echo "includedir is" $includedir "libdir is" $libdir
|
||||||
else
|
else
|
||||||
includedir="${includedir}/simgear"
|
includedir="${includedir}/simgear"
|
||||||
echo "includedir changed to" $includedir "libdir is" $libdir
|
echo "includedir changed to" $includedir "libdir is" $libdir
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl set logging; default value of with_logging=yes
|
dnl set logging; default value of with_logging=yes
|
||||||
AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
|
AC_ARG_WITH(logging, [ --with-logging Include logging output (default)])
|
||||||
if test "x$with_logging" = "xno" ; then
|
if test "x$with_logging" = "xno" ; then
|
||||||
@@ -111,17 +136,48 @@ else
|
|||||||
fi
|
fi
|
||||||
AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
|
AM_CONDITIONAL(ENABLE_JPEG_SERVER, test "x$with_jpeg_factory" = "xyes")
|
||||||
|
|
||||||
# specify the plib location
|
# specify the osg location
|
||||||
AC_ARG_WITH(plib, [ --with-plib=PREFIX Specify the prefix path to plib])
|
AC_ARG_WITH(osg, [ --with-osg=PREFIX Specify the prefix path to osg])
|
||||||
|
|
||||||
if test "x$with_plib" != "x" ; then
|
if test "x$with_osg" != "x" ; then
|
||||||
echo "plib prefix is $with_plib"
|
echo "osg prefix is $with_osg"
|
||||||
EXTRA_DIRS="${EXTRA_DIRS} $with_plib"
|
EXTRA_DIRS="${EXTRA_DIRS} $with_osg"
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_ARG_WITH(osg_framework, [ --with-osg-framework=PREFIX Specify the prefix path to OSG.framework ])
|
||||||
|
|
||||||
|
if test "x$with_osg_framework" != "x"; then
|
||||||
|
echo "osg framework prefix is $with_osg_framework"
|
||||||
|
CPPFLAGS = "$CPPFLAGS -F$with-osg-framework"
|
||||||
|
export DYLD_FRAMEWORK_PATH="$DYLD_FRAMEWORK_PATH:$with_osg_framework"
|
||||||
|
fi
|
||||||
|
|
||||||
|
dnl specifying ALUT.framework (for user provided ALUT.framework)
|
||||||
|
AC_ARG_WITH(alut_framework, [ --with-alut-framework=PREFIX Specify the prefix path to ALUT.framework ])
|
||||||
|
|
||||||
|
if test "x$with_alut_framework" != "x"; then
|
||||||
|
echo "ALUT framework prefix is $with_alut_framework"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# specify the rti13 location
|
||||||
|
AC_ARG_WITH(rti13, [ --with-rti13=PREFIX Specify the prefix path to a HLA13 rti])
|
||||||
|
|
||||||
|
if test "x$with_rti13" != "x" ; then
|
||||||
|
echo "rti13 prefix is $with_rti13"
|
||||||
|
EXTRA_DIRS="${EXTRA_DIRS} $with_rti13"
|
||||||
|
fi
|
||||||
|
|
||||||
|
# specify the rti13 location
|
||||||
|
AC_ARG_WITH(rti1516, [ --with-rti1516=PREFIX Specify the prefix path to a HLA1516 rti])
|
||||||
|
|
||||||
|
if test "x$with_rti1516" != "x" ; then
|
||||||
|
echo "rti1516 prefix is $with_rti1516"
|
||||||
|
EXTRA_DIRS="${EXTRA_DIRS} $with_rti1516"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
dnl Determine an extra directories to add to include/lib search paths
|
dnl Determine an extra directories to add to include/lib search paths
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
*-apple-darwin* | *-*-mingw32*)
|
*-apple-darwin* | *-*-cygwin* | *-*-mingw32*)
|
||||||
echo no EXTRA_DIRS for $host
|
echo no EXTRA_DIRS for $host
|
||||||
;;
|
;;
|
||||||
|
|
||||||
@@ -139,7 +195,7 @@ esac
|
|||||||
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
|
wi_EXTRA_DIRS(no, ${EXTRA_DIRS})
|
||||||
|
|
||||||
|
|
||||||
dnl Using AM_CONDITIONAL is a step out of the protected little
|
dnl Using AM_CONDITIONAL is a step out of the protected little
|
||||||
dnl automake fold so it is potentially dangerous. But, we are
|
dnl automake fold so it is potentially dangerous. But, we are
|
||||||
dnl beginning to run into cases where the standard checks are not
|
dnl beginning to run into cases where the standard checks are not
|
||||||
dnl enough. AM_CONDITIONALS are then referenced to conditionally
|
dnl enough. AM_CONDITIONALS are then referenced to conditionally
|
||||||
@@ -170,7 +226,7 @@ if test "x$ac_cv_header_pthread_h" = "xyes"; then
|
|||||||
|
|
||||||
if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
|
if test "x$ac_cv_search_pthread_exit" = "x-lc_r"; then
|
||||||
CXXFLAGS="-pthread $CXXFLAGS"
|
CXXFLAGS="-pthread $CXXFLAGS"
|
||||||
CFLAGS="-pthread $FLAGS"
|
CFLAGS="-pthread $CFLAGS"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@@ -188,6 +244,7 @@ LIBS=""
|
|||||||
|
|
||||||
dnl check for some default libraries
|
dnl check for some default libraries
|
||||||
AC_SEARCH_LIBS(cos, m)
|
AC_SEARCH_LIBS(cos, m)
|
||||||
|
AC_SEARCH_LIBS(clock_gettime, rt)
|
||||||
|
|
||||||
base_LIBS="$LIBS"
|
base_LIBS="$LIBS"
|
||||||
|
|
||||||
@@ -229,7 +286,7 @@ case "${host}" in
|
|||||||
AC_SEARCH_LIBS(SmcOpenConnection, SM)
|
AC_SEARCH_LIBS(SmcOpenConnection, SM)
|
||||||
AC_SEARCH_LIBS(XtMalloc, Xt)
|
AC_SEARCH_LIBS(XtMalloc, Xt)
|
||||||
AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
|
AC_SEARCH_LIBS(XmuLookupStandardColormap, Xmu)
|
||||||
|
|
||||||
AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
|
AC_SEARCH_LIBS(glNewList, [ GL GLcore MesaGL ])
|
||||||
if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
|
if test "x$ac_cv_search_glNewList" = "x-lGLcore"; then
|
||||||
dnl if GLcore found, then also check for GL
|
dnl if GLcore found, then also check for GL
|
||||||
@@ -255,24 +312,72 @@ LIBS="$base_LIBS"
|
|||||||
|
|
||||||
dnl check for OpenAL libraries
|
dnl check for OpenAL libraries
|
||||||
OPENAL_OK="no"
|
OPENAL_OK="no"
|
||||||
|
ALUT_OK="no"
|
||||||
case "${host}" in
|
case "${host}" in
|
||||||
*-*-cygwin* | *-*-mingw32*)
|
*-*-cygwin* | *-*-mingw32*)
|
||||||
dnl CygWin under Windoze.
|
dnl CygWin under Windoze.
|
||||||
|
INCLUDES="$INCLUDES -I/usr/local/include/"
|
||||||
AC_SEARCH_LIBS(alGenBuffers, openal32)
|
LIBS="$LIBS -L/usr/local/lib"
|
||||||
AC_SEARCH_LIBS(alutInit, [ openal32 ALut ] )
|
AC_SEARCH_LIBS(alGenBuffers, [ openal32 openal 'openal -ldsound -lwinmm' ] )
|
||||||
|
AC_SEARCH_LIBS(alutInit, [ openal32 ALut alut ] )
|
||||||
LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
|
LIBS="$LIBS -lwinmm -ldsound -ldxguid -lole32"
|
||||||
openal_LIBS="$LIBS"
|
openal_LIBS="$LIBS"
|
||||||
OPENAL_OK="$ac_cv_search_alGenBuffers"
|
OPENAL_OK="$ac_cv_search_alGenBuffers"
|
||||||
|
ALUT_OK="$ac_cv_search_alutInit"
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*-apple-darwin*)
|
*-apple-darwin*)
|
||||||
dnl Mac OS X
|
dnl Mac OS X
|
||||||
|
|
||||||
LIBS="$LIBS -framework IOKit -framework OpenAL"
|
LIBS="$LIBS -framework IOKit -framework OpenAL -framework ALUT"
|
||||||
openal_LIBS="$LIBS"
|
openal_LIBS="$LIBS"
|
||||||
# not sure how to test if OpenAL exists on MacOS (does it come by default?)
|
|
||||||
OPENAL_OK="yes"
|
if test "x$with_openal_lib" != "x"; then
|
||||||
|
echo "libopenal is not supported on Mac OS platform."
|
||||||
|
openal_LIBS=""
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_HEADERS([OpenAL/al.h],[OPENAL_OK="yes"])
|
||||||
|
# Looking for alut.h
|
||||||
|
AC_CHECK_HEADERS([ALUT/alut.h],[ALUT_OK="yes"])
|
||||||
|
|
||||||
|
dnl Thank you Christian Bauer from SheepSaver
|
||||||
|
dnl Modified by Tatsuhiro Nishioka for accepting a given framework path
|
||||||
|
dnl AC_CHECK_FRAMEWORK($1=NAME, $2=INCLUDES, $3=FRAMEWORK_PATH, $4=ACTION_IF_TRUE) ; $3 is optional
|
||||||
|
AC_DEFUN([AC_CHECK_FRAMEWORK], [
|
||||||
|
AS_VAR_PUSHDEF([ac_Framework], [ac_cv_framework_$1])dnl
|
||||||
|
AC_CACHE_CHECK([whether compiler supports framework $1],
|
||||||
|
ac_Framework, [
|
||||||
|
saved_LIBS="$LIBS"
|
||||||
|
FRAMEWORKS="$FRAMEWORKS -framework $1"
|
||||||
|
if test "$3" = ""; then
|
||||||
|
FRAMEWORKS="$FRAMEWORKS $ADD2LD"
|
||||||
|
elif test "`echo $FRAMEWORKS | grep -- -F$3`" = ""; then
|
||||||
|
FRAMEWORKS="$FRAMEWORKS -F$3"
|
||||||
|
CXXFLAGS="$CXXFLAGS -F$3"
|
||||||
|
CPPFLAGS="$CPPFLAGS -F$3"
|
||||||
|
CCFLAGS="$CCFLAGS -F$3"
|
||||||
|
dnl This is needed for AC_TRY_LINK when a framework path is specified
|
||||||
|
export DYLD_FRAMEWORK_PATH="${DYLD_FRAMEWORK_PATH}:$3"
|
||||||
|
fi
|
||||||
|
AC_TRY_LINK(
|
||||||
|
[$2], [],
|
||||||
|
[AS_VAR_SET(ac_Framework, yes)], [AS_VAR_SET(ac_Framework, no); LIBS="$saved_LIBS"]
|
||||||
|
)
|
||||||
|
])
|
||||||
|
AS_IF([test AS_VAR_GET(ac_Framework) = yes],
|
||||||
|
[AC_DEFINE(AS_TR_CPP(HAVE_FRAMEWORK_$1), 1, [Define if framework $1 is available.])]
|
||||||
|
)
|
||||||
|
AS_IF([test AS_VAR_GET(ac_Framework) = yes], $4)
|
||||||
|
|
||||||
|
AS_VAR_POPDEF([ac_Framework])dnl
|
||||||
|
])
|
||||||
|
|
||||||
|
dnl Check for ALUT.framework when --with-alut-framework is specified
|
||||||
|
if test "x$with_alut_framework" != "x"; then
|
||||||
|
AC_CHECK_FRAMEWORK(ALUT, [#include <ALUT/alut.h>], $with_alut_framework, [ALUT_OK="yes"])
|
||||||
|
fi
|
||||||
|
|
||||||
;;
|
;;
|
||||||
|
|
||||||
*)
|
*)
|
||||||
@@ -281,14 +386,16 @@ case "${host}" in
|
|||||||
save_LIBS=$LIBS
|
save_LIBS=$LIBS
|
||||||
LIBS="$LIBS $thread_LIBS"
|
LIBS="$LIBS $thread_LIBS"
|
||||||
AC_SEARCH_LIBS(alGenBuffers, openal)
|
AC_SEARCH_LIBS(alGenBuffers, openal)
|
||||||
|
AC_SEARCH_LIBS(alutInit, [ alut openal ] )
|
||||||
OPENAL_OK="$ac_cv_search_alGenBuffers"
|
OPENAL_OK="$ac_cv_search_alGenBuffers"
|
||||||
|
ALUT_OK="$ac_cv_search_alutInit"
|
||||||
openal_LIBS="$LIBS"
|
openal_LIBS="$LIBS"
|
||||||
LIBS=$save_LIBS
|
LIBS=$save_LIBS
|
||||||
;;
|
;;
|
||||||
|
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if test "$OPENAL_OK" == "no"; then
|
if test "$OPENAL_OK" == "no" -a "x$enable_headless" != "xyes"; then
|
||||||
echo
|
echo
|
||||||
echo "You *must* have the openal library installed on your system to build"
|
echo "You *must* have the openal library installed on your system to build"
|
||||||
echo "SimGear!"
|
echo "SimGear!"
|
||||||
@@ -299,6 +406,19 @@ if test "$OPENAL_OK" == "no"; then
|
|||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if test "$ALUT_OK" == "no" -a "x$enable_headless" != "xyes"; then
|
||||||
|
echo
|
||||||
|
echo "You *must* have the alut library installed on your system to build"
|
||||||
|
echo "SimGear!"
|
||||||
|
echo
|
||||||
|
echo "Please see README.OpenAL for more details."
|
||||||
|
echo
|
||||||
|
echo "configure aborted."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
LIBS="$base_LIBS"
|
LIBS="$base_LIBS"
|
||||||
|
|
||||||
AC_SUBST(base_LIBS)
|
AC_SUBST(base_LIBS)
|
||||||
@@ -314,45 +434,93 @@ AM_CONDITIONAL(EXTGL_NEEDED, test "x$ac_cv_header_windows_h" = "xyes")
|
|||||||
# The following are C++ items that need to be tested for with the c++
|
# The following are C++ items that need to be tested for with the c++
|
||||||
# compiler
|
# compiler
|
||||||
|
|
||||||
|
CXXCPP="g++ -E"
|
||||||
AC_LANG_PUSH(C++)
|
AC_LANG_PUSH(C++)
|
||||||
|
|
||||||
dnl Check for "plib" without which we cannot go on
|
# OpenSceneGraph
|
||||||
AC_CHECK_HEADER(plib/ul.h)
|
case "${host}" in
|
||||||
if test "x$ac_cv_header_plib_ul_h" != "xyes"; then
|
*-apple-darwin*)
|
||||||
|
if test "x$with_osg_framework" != "x"; then
|
||||||
|
# AC_CHECK_FRAMEWORK(osgViewer, [#include <osgViewer/Version>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgGA, [#include <osgGA/Version>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgText, [#include <osgText/Version>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgFX, [#include <osgFX/AnisotropicLighting>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgUtil, [#include <osgUtil/Version>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgDB, [#include <osgDB/Version>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgSim, [#include <osgSim/Version>], $with_osg_framework)
|
||||||
|
# AC_CHECK_FRAMEWORK(osgParticle, [#include <osgParticle/Version>], $with_osg_framework)
|
||||||
|
AC_CHECK_FRAMEWORK(osg, [#include <osg/Version>], $with_osg_framework)
|
||||||
|
# osg_FRAMEWORKS="$FRAMEWORKS"
|
||||||
|
# FRAMEWORKS=""
|
||||||
|
# AC_SUBST(osg_FRAMEWORKS)
|
||||||
|
AC_CHECK_FRAMEWORK(OpenThreads, [#include <OpenThreads/Version>], $with_osg_framework)
|
||||||
|
openthreads_FRAMEWORK="$FRAMEWORKS"
|
||||||
|
FRAMEWORKS=""
|
||||||
|
AC_SUBST(openthreads_FRAMEWORK)
|
||||||
|
else
|
||||||
|
dnl
|
||||||
|
dnl This is needed when osg dynamic libs are specified
|
||||||
|
dnl instead of OSG frameworks on Mac OS X
|
||||||
|
dnl
|
||||||
|
AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
if test "x$enable_osgdebug" = "xyes"; then
|
||||||
|
AC_CHECK_LIB(OpenThreadsd,OpenThreadsGetVersion)
|
||||||
|
else
|
||||||
|
AC_CHECK_LIB(OpenThreads,OpenThreadsGetVersion)
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
AM_CONDITIONAL(HAVE_FRAMEWORK_OSG, test "x$ac_cv_framework_osg" != "x")
|
||||||
|
|
||||||
|
AC_CHECK_HEADER(osg/Version)
|
||||||
|
|
||||||
|
if test "x$ac_cv_header_osg_Version" != "xyes" -o "x$ac_cv_lib_OpenThreads_OpenThreadsGetVersion" != "xyes"; then
|
||||||
|
if test "x$ac_cv_framework_osg" != "xyes"; then
|
||||||
echo
|
echo
|
||||||
echo "You *must* have the plib library installed on your system to build"
|
echo "You *must* have the OpenThreads library installed on your system"
|
||||||
echo "SimGear!"
|
echo "to build this version of SimGear!"
|
||||||
|
echo " Maybe you need to specify --with-osg=DIR."
|
||||||
|
echo " Maybe you need to specify some LDFLAGS to help the linker."
|
||||||
echo
|
echo
|
||||||
echo "Please see README.plib for more details."
|
echo " LIBS: '$LIBS'"
|
||||||
|
echo " LDFLAGS: '$LDFLAGS'"
|
||||||
|
echo " CPPFLAGS: '$CPPFLAGS'"
|
||||||
|
echo
|
||||||
|
echo "Please see README.OSG for more details."
|
||||||
|
echo
|
||||||
|
echo "configure aborted."
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
AC_CHECK_HEADER(boost/version.hpp)
|
||||||
|
if test "x$ac_cv_header_boost_version_hpp" != "xyes"; then
|
||||||
|
echo
|
||||||
|
echo "You *must* have the Boost library installed on your system"
|
||||||
|
echo "to build this version of SimGear!"
|
||||||
|
echo
|
||||||
|
echo " LIBS: '$LIBS'"
|
||||||
|
echo " LDFLAGS: '$LDFLAGS'"
|
||||||
|
echo " CPPFLAGS: '$CPPFLAGS'"
|
||||||
echo
|
echo
|
||||||
echo "configure aborted."
|
echo "configure aborted."
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
AC_MSG_CHECKING([for plib 1.8.4 or newer])
|
dnl Check for a HLA13 rti.
|
||||||
AC_TRY_RUN([
|
dnl This is really tricky because of the ancient iostream stuff in RTI13
|
||||||
#include <plib/ul.h>
|
saved_CPPFLAGS="$CPPFLAGS"
|
||||||
|
CPPFLAGS="$CPPFLAGS -DRTI_USES_STD_FSTREAM"
|
||||||
|
AC_CHECK_HEADER(RTI.hh)
|
||||||
|
CPPFLAGS="${saved_CPPFLAGS}"
|
||||||
|
|
||||||
#define MIN_PLIB_VERSION 184
|
dnl Up to now only RTI13
|
||||||
|
AM_CONDITIONAL(ENABLE_HLA, test "x$ac_cv_header_RTI_hh" = "xyes")
|
||||||
int main() {
|
AM_CONDITIONAL(ENABLE_HLA13, test "x$ac_cv_header_RTI_hh" = "xyes")
|
||||||
int major, minor, micro;
|
|
||||||
|
|
||||||
if ( PLIB_VERSION < MIN_PLIB_VERSION ) {
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
],
|
|
||||||
AC_MSG_RESULT(yes),
|
|
||||||
[AC_MSG_RESULT(wrong version);
|
|
||||||
AC_MSG_ERROR([Install plib 1.8.4 or later first...])],
|
|
||||||
AC_MSG_RESULT(yes)
|
|
||||||
)
|
|
||||||
|
|
||||||
LIBS="$saved_LIBS"
|
|
||||||
|
|
||||||
AC_LANG_POP
|
AC_LANG_POP
|
||||||
|
|
||||||
@@ -372,6 +540,39 @@ if test "x$ac_cv_header_zlib_h" != "xyes"; then
|
|||||||
echo
|
echo
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
dnl Check for Subversion library support
|
||||||
|
# libsvn support defaults to yes
|
||||||
|
save_LIBS=$LIBS
|
||||||
|
save_CPPFLAGS=$CPPFLAGS
|
||||||
|
AC_ARG_WITH(libsvn, [ --without-libsvn Do not use built-in subversion (libsvn) for simgear [default=no]], [], [with_libsvn=yes])
|
||||||
|
if test "x$with_libsvn" = "xyes"; then
|
||||||
|
LIBS="`apr-1-config --link-ld`"
|
||||||
|
CPPFLAGS="-I/usr/include/subversion-1 `apr-1-config --includes --cppflags`"
|
||||||
|
AC_CHECK_HEADERS([svn_client.h])
|
||||||
|
if test "x$ac_cv_header_svn_client_h" = "xyes"; then
|
||||||
|
echo "Using built-in subversion (libsvn) for scenery downloads."
|
||||||
|
AC_SEARCH_LIBS(svn_client_checkout, svn_client-1,
|
||||||
|
[AC_DEFINE([HAVE_LIBSVN_CLIENT_1], [1], [Define to 1 if you have libsvn_client-1])],
|
||||||
|
[AC_MSG_ERROR(svn_client-1 library not found.)],)
|
||||||
|
AC_SEARCH_LIBS(svn_cmdline_init, svn_subr-1, , [AC_MSG_ERROR(svn_subr-1 library not found.)],)
|
||||||
|
AC_SEARCH_LIBS(svn_ra_initialize, svn_ra-1, , [AC_MSG_ERROR(svn_ra-1 library not found.)],)
|
||||||
|
svn_LIBS=$LIBS
|
||||||
|
svn_CPPFLAGS=$CPPFLAGS
|
||||||
|
AC_SUBST(svn_LIBS)
|
||||||
|
AC_SUBST(svn_CPPFLAGS)
|
||||||
|
else
|
||||||
|
echo "Libsvn not found. Will use command line subversion for scenery downloads."
|
||||||
|
svn_LIBS=""
|
||||||
|
svn_CPPFLAGS=""
|
||||||
|
fi
|
||||||
|
else
|
||||||
|
echo "Libsvn explicitly disabled. Will use command line subversion for scenery downloads."
|
||||||
|
svn_LIBS=""
|
||||||
|
svn_CPPFLAGS=""
|
||||||
|
fi
|
||||||
|
LIBS=$save_LIBS
|
||||||
|
CPPFLAGS=$save_CPPFLAGS
|
||||||
|
|
||||||
dnl Checks for header files.
|
dnl Checks for header files.
|
||||||
AC_HEADER_STDC
|
AC_HEADER_STDC
|
||||||
AC_CHECK_HEADERS( \
|
AC_CHECK_HEADERS( \
|
||||||
@@ -385,6 +586,7 @@ fi
|
|||||||
dnl Checks for typedefs, structures, and compiler characteristics.
|
dnl Checks for typedefs, structures, and compiler characteristics.
|
||||||
AC_C_CONST
|
AC_C_CONST
|
||||||
AC_TYPE_SIZE_T
|
AC_TYPE_SIZE_T
|
||||||
|
AC_TYPE_MODE_T
|
||||||
AC_HEADER_TIME
|
AC_HEADER_TIME
|
||||||
AC_STRUCT_TM
|
AC_STRUCT_TM
|
||||||
|
|
||||||
@@ -403,7 +605,6 @@ AM_CONFIG_HEADER(simgear/simgear_config.h)
|
|||||||
AC_CONFIG_FILES([ \
|
AC_CONFIG_FILES([ \
|
||||||
Makefile \
|
Makefile \
|
||||||
SimGear.spec \
|
SimGear.spec \
|
||||||
src-libs/Makefile \
|
|
||||||
simgear/Makefile \
|
simgear/Makefile \
|
||||||
simgear/version.h \
|
simgear/version.h \
|
||||||
simgear/compatibility/Makefile \
|
simgear/compatibility/Makefile \
|
||||||
@@ -412,6 +613,7 @@ AC_CONFIG_FILES([ \
|
|||||||
simgear/bucket/Makefile \
|
simgear/bucket/Makefile \
|
||||||
simgear/debug/Makefile \
|
simgear/debug/Makefile \
|
||||||
simgear/ephemeris/Makefile \
|
simgear/ephemeris/Makefile \
|
||||||
|
simgear/hla/Makefile \
|
||||||
simgear/io/Makefile \
|
simgear/io/Makefile \
|
||||||
simgear/magvar/Makefile \
|
simgear/magvar/Makefile \
|
||||||
simgear/math/Makefile \
|
simgear/math/Makefile \
|
||||||
@@ -421,18 +623,19 @@ AC_CONFIG_FILES([ \
|
|||||||
simgear/props/Makefile \
|
simgear/props/Makefile \
|
||||||
simgear/route/Makefile \
|
simgear/route/Makefile \
|
||||||
simgear/scene/Makefile \
|
simgear/scene/Makefile \
|
||||||
|
simgear/scene/bvh/Makefile \
|
||||||
simgear/scene/material/Makefile \
|
simgear/scene/material/Makefile \
|
||||||
simgear/scene/model/Makefile \
|
simgear/scene/model/Makefile \
|
||||||
simgear/scene/sky/Makefile \
|
simgear/scene/sky/Makefile \
|
||||||
simgear/scene/sky/clouds3d/Makefile \
|
|
||||||
simgear/scene/tgdb/Makefile \
|
simgear/scene/tgdb/Makefile \
|
||||||
|
simgear/scene/util/Makefile \
|
||||||
|
simgear/scene/tsync/Makefile \
|
||||||
simgear/screen/Makefile \
|
simgear/screen/Makefile \
|
||||||
simgear/serial/Makefile \
|
simgear/serial/Makefile \
|
||||||
simgear/sound/Makefile \
|
simgear/sound/Makefile \
|
||||||
simgear/structure/Makefile \
|
simgear/structure/Makefile \
|
||||||
simgear/threads/Makefile \
|
simgear/threads/Makefile \
|
||||||
simgear/timing/Makefile \
|
simgear/timing/Makefile \
|
||||||
simgear/xgl/Makefile \
|
|
||||||
simgear/xml/Makefile \
|
simgear/xml/Makefile \
|
||||||
])
|
])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|||||||
@@ -0,0 +1,2 @@
|
|||||||
|
The handmade VS2010 project files have been replaced by the Cmake build system.
|
||||||
|
Please use Cmake to build FlightGear with Visual Studio 2010.
|
||||||
@@ -0,0 +1,3 @@
|
|||||||
|
*.user
|
||||||
|
Win32
|
||||||
|
x64
|
||||||
File diff suppressed because it is too large
Load Diff
@@ -1,8 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
simgear_config.h
|
|
||||||
simgear_config.h.in
|
|
||||||
stamp-h
|
|
||||||
stamp-h.in
|
|
||||||
stamp-h1
|
|
||||||
version.h
|
|
||||||
@@ -0,0 +1,4 @@
|
|||||||
|
simgear_config.h
|
||||||
|
simgear_config.h.*
|
||||||
|
stamp-h1
|
||||||
|
version.h
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
|
||||||
|
file(WRITE ${PROJECT_BINARY_DIR}/simgear/version.h "#define SIMGEAR_VERSION ${SIMGEAR_VERSION}")
|
||||||
|
|
||||||
|
foreach( mylibfolder
|
||||||
|
bucket
|
||||||
|
debug
|
||||||
|
ephemeris
|
||||||
|
hla
|
||||||
|
io
|
||||||
|
magvar
|
||||||
|
math
|
||||||
|
misc
|
||||||
|
nasal
|
||||||
|
props
|
||||||
|
route
|
||||||
|
serial
|
||||||
|
structure
|
||||||
|
threads
|
||||||
|
timing
|
||||||
|
xml
|
||||||
|
)
|
||||||
|
|
||||||
|
add_subdirectory(${mylibfolder})
|
||||||
|
|
||||||
|
endforeach( mylibfolder )
|
||||||
|
|
||||||
|
if (NOT SIMGEAR_HEADLESS)
|
||||||
|
add_subdirectory(environment)
|
||||||
|
add_subdirectory(screen)
|
||||||
|
add_subdirectory(scene)
|
||||||
|
add_subdirectory(sound)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
set(HEADERS compiler.h constants.h sg_inlines.h ${PROJECT_BINARY_DIR}/simgear/version.h)
|
||||||
|
install (FILES ${HEADERS} DESTINATION include/simgear/)
|
||||||
|
|
||||||
|
if(SIMGEAR_SHARED)
|
||||||
|
message(STATUS "building shared library")
|
||||||
|
get_property(allSources GLOBAL PROPERTY ALL_SOURCES)
|
||||||
|
get_property(publicHeaders GLOBAL PROPERTY PUBLIC_HEADERS)
|
||||||
|
|
||||||
|
add_library(SimGear SHARED ${allSources})
|
||||||
|
set_property(TARGET SimGear PROPERTY FRAMEWORK 1)
|
||||||
|
message(STATUS "public header: ${publicHeaders}")
|
||||||
|
set_property(TARGET SimGear PROPERTY PUBLIC_HEADER "${publicHeaders}")
|
||||||
|
set_property(TARGET SimGear PROPERTY LINKER_LANGUAGE CXX)
|
||||||
|
|
||||||
|
target_link_libraries(SimGear ${ZLIB_LIBRARY}
|
||||||
|
${OPENSCENEGRAPH_LIBRARIES}
|
||||||
|
${OPENAL_LIBRARY} ${ALUT_LIBRARY}
|
||||||
|
${OPENGL_LIBRARY})
|
||||||
|
|
||||||
|
install(TARGETS SimGear LIBRARY DESTINATION lib${LIB_SUFFIX}
|
||||||
|
PUBLIC_HEADER DESTINATION include/simgear)
|
||||||
|
endif(SIMGEAR_SHARED)
|
||||||
|
|
||||||
+30
-18
@@ -1,38 +1,50 @@
|
|||||||
|
if ENABLE_HLA
|
||||||
|
HLA_DIR = hla
|
||||||
|
else
|
||||||
|
HLA_DIR =
|
||||||
|
endif
|
||||||
|
|
||||||
|
EXTRA_DIST = simgear_config.h.vc5 simgear_config.h-msvc71 version.h.in
|
||||||
|
|
||||||
|
include_HEADERS = \
|
||||||
|
compiler.h constants.h sg_inlines.h version.h
|
||||||
|
|
||||||
|
if WANT_HEADLESS
|
||||||
|
SG_EXTRA_DIRS =
|
||||||
|
METAR_DIRS =
|
||||||
|
else
|
||||||
|
SG_EXTRA_DIRS = scene sound screen
|
||||||
|
METAR_DIRS = environment
|
||||||
|
endif
|
||||||
|
|
||||||
if HAVE_THREADS
|
if HAVE_THREADS
|
||||||
SGTHREAD_DIR = threads
|
SGTHREAD_DIR = threads
|
||||||
else
|
else
|
||||||
SGTHREAD_DIR =
|
SGTHREAD_DIR =
|
||||||
endif
|
endif
|
||||||
|
|
||||||
# METAR_DIRS =
|
SUBDIRS_ALWAYS = \
|
||||||
METAR_DIRS = environment
|
|
||||||
|
|
||||||
EXTRA_DIST = simgear_config.h.vc5 version.h.in
|
|
||||||
|
|
||||||
include_HEADERS = \
|
|
||||||
compiler.h constants.h sg_inlines.h sg_traits.hxx version.h
|
|
||||||
|
|
||||||
SUBDIRS = \
|
|
||||||
$(compatibility_DIR) \
|
|
||||||
xml \
|
xml \
|
||||||
debug \
|
debug \
|
||||||
misc \
|
misc \
|
||||||
structure \
|
structure \
|
||||||
bucket \
|
bucket \
|
||||||
ephemeris \
|
ephemeris \
|
||||||
|
$(HLA_DIR) \
|
||||||
io \
|
io \
|
||||||
magvar \
|
magvar \
|
||||||
math \
|
math \
|
||||||
$(METAR_DIRS) \
|
|
||||||
nasal \
|
nasal \
|
||||||
props \
|
props \
|
||||||
route \
|
route \
|
||||||
scene \
|
|
||||||
screen \
|
|
||||||
serial \
|
serial \
|
||||||
sound \
|
timing
|
||||||
$(SGTHREAD_DIR) \
|
|
||||||
timing \
|
SUBDIRS = $(SUBDIRS_ALWAYS) \
|
||||||
xgl
|
$(compatibility_DIR) \
|
||||||
|
$(METAR_DIRS) \
|
||||||
|
$(SG_EXTRA_DIRS) \
|
||||||
|
$(SGTHREAD_DIR)
|
||||||
|
|
||||||
|
DIST_SUBDIRS = $(SUBDIRS_ALWAYS) compatibility scene sound screen environment threads
|
||||||
|
|
||||||
DIST_SUBDIRS = $(SUBDIRS) compatibility threads
|
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS newbucket.hxx)
|
||||||
|
set(SOURCES newbucket.cxx)
|
||||||
|
|
||||||
|
simgear_component(bucket bucket "${SOURCES}" "${HEADERS}")
|
||||||
@@ -11,7 +11,7 @@ libsgbucket_a_SOURCES = newbucket.cxx
|
|||||||
# testbucket_SOURCES = testbucket.cxx
|
# testbucket_SOURCES = testbucket.cxx
|
||||||
|
|
||||||
# testbucket_LDADD = \
|
# testbucket_LDADD = \
|
||||||
# $(top_builddir)/bucket/libsgbucket.a \
|
# libsgbucket.a \
|
||||||
# $(top_builddir)/misc/libsgmisc.a
|
# $(top_builddir)/misc/libsgmisc.a
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)
|
INCLUDES = -I$(top_srcdir)
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -45,6 +44,9 @@ SGBucket::SGBucket(const double dlon, const double dlat) {
|
|||||||
set_bucket(dlon, dlat);
|
set_bucket(dlon, dlat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
SGBucket::SGBucket(const SGGeod& geod) {
|
||||||
|
set_bucket(geod);
|
||||||
|
}
|
||||||
|
|
||||||
// create an impossible bucket if false
|
// create an impossible bucket if false
|
||||||
SGBucket::SGBucket(const bool is_good) {
|
SGBucket::SGBucket(const bool is_good) {
|
||||||
@@ -74,11 +76,6 @@ SGBucket::SGBucket(const long int bindex) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// default destructor
|
|
||||||
SGBucket::~SGBucket() {
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
// Set the bucket params for the specified lat and lon
|
// Set the bucket params for the specified lat and lon
|
||||||
void SGBucket::set_bucket( double *lonlat ) {
|
void SGBucket::set_bucket( double *lonlat ) {
|
||||||
set_bucket( lonlat[0], lonlat[1] );
|
set_bucket( lonlat[0], lonlat[1] );
|
||||||
@@ -95,6 +92,11 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
|
|||||||
|
|
||||||
// cout << "diff = " << diff << " span = " << span << endl;
|
// cout << "diff = " << diff << " span = " << span << endl;
|
||||||
|
|
||||||
|
/* Calculate the greatest integral longitude less than
|
||||||
|
* or equal to the given longitude (floor(dlon)),
|
||||||
|
* but attribute coordinates near the east border
|
||||||
|
* to the next tile.
|
||||||
|
*/
|
||||||
if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
||||||
lon = (int)dlon;
|
lon = (int)dlon;
|
||||||
} else {
|
} else {
|
||||||
@@ -103,22 +105,48 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
|
|||||||
|
|
||||||
// find subdivision or super lon if needed
|
// find subdivision or super lon if needed
|
||||||
if ( span < SG_EPSILON ) {
|
if ( span < SG_EPSILON ) {
|
||||||
|
/* sg_bucket_span() never returns 0.0
|
||||||
|
* or anything near it, so this really
|
||||||
|
* should not occur at any time.
|
||||||
|
*/
|
||||||
// polar cap
|
// polar cap
|
||||||
lon = 0;
|
lon = 0;
|
||||||
x = 0;
|
x = 0;
|
||||||
} else if ( span <= 1.0 ) {
|
} else if ( span <= 1.0 ) {
|
||||||
|
/* We have more than one tile per degree of
|
||||||
|
* longitude, so we need an x offset.
|
||||||
|
*/
|
||||||
x = (int)((dlon - lon) / span);
|
x = (int)((dlon - lon) / span);
|
||||||
} else {
|
} else {
|
||||||
if ( (dlon >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
/* We have one or more degrees per tile,
|
||||||
lon = (int)( (int)(lon / span) * span);
|
* so we need to find the base longitude
|
||||||
} else {
|
* of that tile.
|
||||||
// cout << " lon = " << lon
|
*
|
||||||
// << " tmp = " << (int)((lon-1) / span) << endl;
|
* First we calculate the integral base longitude
|
||||||
lon = (int)( (int)((lon + 1) / span) * span - span);
|
* (e.g. -85.5 => -86) and then find the greatest
|
||||||
if ( lon < -180 ) {
|
* multiple of span that is less than or equal to
|
||||||
lon = -180;
|
* that longitude.
|
||||||
}
|
*
|
||||||
}
|
* That way, the Greenwich Meridian is always
|
||||||
|
* a tile border.
|
||||||
|
*
|
||||||
|
* This gets us into trouble with the polar caps,
|
||||||
|
* which have width 360 and thus either span
|
||||||
|
* the range from 0 to 360 or from -360 to 0
|
||||||
|
* degrees, depending on whether lon is positive
|
||||||
|
* or negative!
|
||||||
|
*
|
||||||
|
* We also get into trouble with the 8 degree tiles
|
||||||
|
* north of 88N and south of 88S, because the west-
|
||||||
|
* and east-most tiles in that range will cover 184W
|
||||||
|
* to 176W and 176E to 184E respectively, with their
|
||||||
|
* center at 180E/W!
|
||||||
|
*/
|
||||||
|
lon=(int)floor(floor((lon+SG_EPSILON)/span)*span);
|
||||||
|
/* Correct the polar cap issue */
|
||||||
|
if ( lon < -180 ) {
|
||||||
|
lon = -180;
|
||||||
|
}
|
||||||
x = 0;
|
x = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -127,17 +155,26 @@ void SGBucket::set_bucket( double dlon, double dlat ) {
|
|||||||
//
|
//
|
||||||
diff = dlat - (double)(int)dlat;
|
diff = dlat - (double)(int)dlat;
|
||||||
|
|
||||||
|
/* Again, a modified floor() function (see longitude) */
|
||||||
if ( (dlat >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
if ( (dlat >= 0) || (fabs(diff) < SG_EPSILON) ) {
|
||||||
lat = (int)dlat;
|
lat = (int)dlat;
|
||||||
} else {
|
} else {
|
||||||
lat = (int)dlat - 1;
|
lat = (int)dlat - 1;
|
||||||
}
|
}
|
||||||
|
/* Latitude base and offset are easier, as
|
||||||
|
* tiles always are 1/8 degree of latitude wide.
|
||||||
|
*/
|
||||||
y = (int)((dlat - lat) * 8);
|
y = (int)((dlat - lat) * 8);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SGBucket::set_bucket(const SGGeod& geod)
|
||||||
|
{
|
||||||
|
set_bucket(geod.getLongitudeDeg(), geod.getLatitudeDeg());
|
||||||
|
}
|
||||||
|
|
||||||
// Build the path name for this bucket
|
// Build the path name for this bucket
|
||||||
string SGBucket::gen_base_path() const {
|
std::string SGBucket::gen_base_path() const {
|
||||||
// long int index;
|
// long int index;
|
||||||
int top_lon, top_lat, main_lon, main_lat;
|
int top_lon, top_lat, main_lon, main_lat;
|
||||||
char hem, pole;
|
char hem, pole;
|
||||||
@@ -187,6 +224,17 @@ string SGBucket::gen_base_path() const {
|
|||||||
|
|
||||||
// return width of the tile in degrees
|
// return width of the tile in degrees
|
||||||
double SGBucket::get_width() const {
|
double SGBucket::get_width() const {
|
||||||
|
if (lon==-180 && (lat==-89 || lat==88) ) {
|
||||||
|
/* Normally the tile at 180W in 88N and 89S
|
||||||
|
* would cover 184W to 176W and the next
|
||||||
|
* on the east side starts at 176W.
|
||||||
|
* To correct, make this a special tile
|
||||||
|
* from 180W to 176W with 4 degrees width
|
||||||
|
* instead of the normal 8 degrees at
|
||||||
|
* that latitude.
|
||||||
|
*/
|
||||||
|
return 4.0;
|
||||||
|
}
|
||||||
return sg_bucket_span( get_center_lat() );
|
return sg_bucket_span( get_center_lat() );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -208,16 +256,16 @@ double SGBucket::get_width_m() const {
|
|||||||
double clat_rad = clat * SGD_DEGREES_TO_RADIANS;
|
double clat_rad = clat * SGD_DEGREES_TO_RADIANS;
|
||||||
double cos_lat = cos( clat_rad );
|
double cos_lat = cos( clat_rad );
|
||||||
double local_radius = cos_lat * SG_EQUATORIAL_RADIUS_M;
|
double local_radius = cos_lat * SG_EQUATORIAL_RADIUS_M;
|
||||||
double local_perimeter = 2.0 * local_radius * SGD_PI;
|
double local_perimeter = local_radius * SGD_2PI;
|
||||||
double degree_width = local_perimeter / 360.0;
|
double degree_width = local_perimeter / 360.0;
|
||||||
|
|
||||||
return sg_bucket_span( get_center_lat() ) * degree_width;
|
return get_width() * degree_width;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
// return height of the tile in meters
|
// return height of the tile in meters
|
||||||
double SGBucket::get_height_m() const {
|
double SGBucket::get_height_m() const {
|
||||||
double perimeter = 2.0 * SG_EQUATORIAL_RADIUS_M * SGD_PI;
|
double perimeter = SG_EQUATORIAL_RADIUS_M * SGD_2PI;
|
||||||
double degree_height = perimeter / 360.0;
|
double degree_height = perimeter / 360.0;
|
||||||
|
|
||||||
return SG_BUCKET_SPAN * degree_height;
|
return SG_BUCKET_SPAN * degree_height;
|
||||||
@@ -271,16 +319,32 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy ) {
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
// longitude difference
|
// longitude difference
|
||||||
double c1_lon = b1.get_center_lon();
|
double diff_lon=0.0;
|
||||||
double c2_lon = b2.get_center_lon();
|
double span=0.0;
|
||||||
double diff_lon = c2_lon - c1_lon;
|
|
||||||
double span;
|
SGBucket tmp_bucket;
|
||||||
if ( sg_bucket_span(c1_lat) <= sg_bucket_span(c2_lat) ) {
|
// To handle crossing the bucket size boundary
|
||||||
|
// we need to account for different size buckets.
|
||||||
|
|
||||||
|
if ( sg_bucket_span(c1_lat) <= sg_bucket_span(c2_lat) )
|
||||||
|
{
|
||||||
span = sg_bucket_span(c1_lat);
|
span = sg_bucket_span(c1_lat);
|
||||||
} else {
|
} else {
|
||||||
span = sg_bucket_span(c2_lat);
|
span = sg_bucket_span(c2_lat);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
diff_lon = b2.get_center_lon() - b1.get_center_lon();
|
||||||
|
|
||||||
|
if (diff_lon <0.0)
|
||||||
|
{
|
||||||
|
diff_lon -= b1.get_width()*0.5 + b2.get_width()*0.5 - span;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
diff_lon += b1.get_width()*0.5 + b2.get_width()*0.5 - span;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
#ifdef HAVE_RINT
|
#ifdef HAVE_RINT
|
||||||
*dx = (int)rint( diff_lon / span );
|
*dx = (int)rint( diff_lon / span );
|
||||||
#else
|
#else
|
||||||
|
|||||||
@@ -15,16 +15,20 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
/** \file newbucket.hxx
|
/** \file newbucket.hxx
|
||||||
* A class and associated utiltity functions to manage world scenery tiling.
|
* A class and associated utiltity functions to manage world scenery tiling.
|
||||||
|
*
|
||||||
|
* Tile borders are aligned along circles of latitude and longitude.
|
||||||
|
* All tiles are 1/8 degree of latitude high and their width in degrees
|
||||||
|
* longitude depends on their latitude, adjusted in such a way that
|
||||||
|
* all tiles cover about the same amount of area of the earth surface.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _NEWBUCKET_HXX
|
#ifndef _NEWBUCKET_HXX
|
||||||
@@ -32,30 +36,12 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
#include <cmath>
|
||||||
# include <cmath>
|
#include <cstdio> // sprintf()
|
||||||
# include <cstdio> // sprintf()
|
#include <ostream>
|
||||||
#else
|
#include <string>
|
||||||
# include <math.h>
|
|
||||||
# include <stdio.h> // sprintf()
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include STL_IOSTREAM
|
|
||||||
|
|
||||||
// I don't understand ... <math.h> or <cmath> should be included
|
|
||||||
// already depending on how you defined SG_HAVE_STD_INCLUDES, but I
|
|
||||||
// can go ahead and add this -- CLO
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
SG_USING_STD(sprintf);
|
|
||||||
SG_USING_STD(fabs);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include STL_STRING
|
|
||||||
|
|
||||||
SG_USING_STD(string);
|
|
||||||
SG_USING_STD(ostream);
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* standard size of a bucket in degrees (1/8 of a degree)
|
* standard size of a bucket in degrees (1/8 of a degree)
|
||||||
@@ -114,11 +100,10 @@ static double sg_bucket_span( double l ) {
|
|||||||
class SGBucket {
|
class SGBucket {
|
||||||
|
|
||||||
private:
|
private:
|
||||||
double cx, cy; // centerpoint (lon, lat) in degrees of bucket
|
short lon; // longitude index (-180 to 179)
|
||||||
int lon; // longitude index (-180 to 179)
|
short lat; // latitude index (-90 to 89)
|
||||||
int lat; // latitude index (-90 to 89)
|
char x; // x subdivision (0 to 7)
|
||||||
int x; // x subdivision (0 to 7)
|
char y; // y subdivision (0 to 7)
|
||||||
int y; // y subdivision (0 to 7)
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
@@ -134,6 +119,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
SGBucket(const double dlon, const double dlat);
|
SGBucket(const double dlon, const double dlat);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Construct a bucket given a specific location.
|
||||||
|
* @param dlon longitude specified in degrees
|
||||||
|
* @param dlat latitude specified in degrees
|
||||||
|
*/
|
||||||
|
SGBucket(const SGGeod& geod);
|
||||||
|
|
||||||
/** Construct a bucket.
|
/** Construct a bucket.
|
||||||
* @param is_good if false, create an invalid bucket. This is
|
* @param is_good if false, create an invalid bucket. This is
|
||||||
* useful * if you are comparing cur_bucket to last_bucket and
|
* useful * if you are comparing cur_bucket to last_bucket and
|
||||||
@@ -147,11 +139,6 @@ public:
|
|||||||
*/
|
*/
|
||||||
SGBucket(const long int bindex);
|
SGBucket(const long int bindex);
|
||||||
|
|
||||||
/**
|
|
||||||
* Default destructor.
|
|
||||||
*/
|
|
||||||
~SGBucket();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Reset a bucket to represent a new lat and lon
|
* Reset a bucket to represent a new lat and lon
|
||||||
* @param dlon longitude specified in degrees
|
* @param dlon longitude specified in degrees
|
||||||
@@ -166,6 +153,13 @@ public:
|
|||||||
*/
|
*/
|
||||||
void set_bucket( double *lonlat );
|
void set_bucket( double *lonlat );
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Reset a bucket to represent a new lat and lon
|
||||||
|
* @param dlon longitude specified in degrees
|
||||||
|
* @param dlat latitude specified in degrees
|
||||||
|
*/
|
||||||
|
void set_bucket(const SGGeod& geod);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Create an impossible bucket.
|
* Create an impossible bucket.
|
||||||
* This is useful if you are comparing cur_bucket to last_bucket
|
* This is useful if you are comparing cur_bucket to last_bucket
|
||||||
@@ -201,18 +195,19 @@ public:
|
|||||||
* string form.
|
* string form.
|
||||||
* @return tile index in string form
|
* @return tile index in string form
|
||||||
*/
|
*/
|
||||||
inline string gen_index_str() const {
|
inline std::string gen_index_str() const {
|
||||||
char tmp[20];
|
char tmp[20];
|
||||||
sprintf(tmp, "%ld",
|
std::sprintf(tmp, "%ld",
|
||||||
(((long)lon + 180) << 14) + ((lat + 90) << 6) + (y << 3) + x);
|
(((long)lon + 180) << 14) + ((lat + 90) << 6)
|
||||||
return (string)tmp;
|
+ (y << 3) + x);
|
||||||
|
return (std::string)tmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Build the base path name for this bucket.
|
* Build the base path name for this bucket.
|
||||||
* @return base path in string form
|
* @return base path in string form
|
||||||
*/
|
*/
|
||||||
string gen_base_path() const;
|
std::string gen_base_path() const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return the center lon of a tile.
|
* @return the center lon of a tile.
|
||||||
@@ -221,9 +216,9 @@ public:
|
|||||||
double span = sg_bucket_span( lat + y / 8.0 + SG_HALF_BUCKET_SPAN );
|
double span = sg_bucket_span( lat + y / 8.0 + SG_HALF_BUCKET_SPAN );
|
||||||
|
|
||||||
if ( span >= 1.0 ) {
|
if ( span >= 1.0 ) {
|
||||||
return lon + span / 2.0;
|
return lon + get_width() / 2.0;
|
||||||
} else {
|
} else {
|
||||||
return lon + x * span + span / 2.0;
|
return lon + x * span + get_width() / 2.0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -253,7 +248,24 @@ public:
|
|||||||
* @return the height of the tile in meters.
|
* @return the height of the tile in meters.
|
||||||
*/
|
*/
|
||||||
double get_height_m() const;
|
double get_height_m() const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the center of the bucket in geodetic coordinates.
|
||||||
|
*/
|
||||||
|
SGGeod get_center() const
|
||||||
|
{ return SGGeod::fromDeg(get_center_lon(), get_center_lat()); }
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return the center of the bucket in geodetic coordinates.
|
||||||
|
*/
|
||||||
|
SGGeod get_corner(unsigned num) const
|
||||||
|
{
|
||||||
|
double lonFac = ((num + 1) & 2) ? 0.5 : -0.5;
|
||||||
|
double latFac = ((num ) & 2) ? 0.5 : -0.5;
|
||||||
|
return SGGeod::fromDeg(get_center_lon() + lonFac*get_width(),
|
||||||
|
get_center_lat() + latFac*get_height());
|
||||||
|
}
|
||||||
|
|
||||||
// Informational methods.
|
// Informational methods.
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -280,10 +292,15 @@ public:
|
|||||||
|
|
||||||
// friends
|
// friends
|
||||||
|
|
||||||
friend ostream& operator<< ( ostream&, const SGBucket& );
|
friend std::ostream& operator<< ( std::ostream&, const SGBucket& );
|
||||||
friend bool operator== ( const SGBucket&, const SGBucket& );
|
friend bool operator== ( const SGBucket&, const SGBucket& );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
inline bool operator!= (const SGBucket& lhs, const SGBucket& rhs)
|
||||||
|
{
|
||||||
|
return !(lhs == rhs);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \relates SGBucket
|
* \relates SGBucket
|
||||||
@@ -314,10 +331,10 @@ void sgBucketDiff( const SGBucket& b1, const SGBucket& b2, int *dx, int *dy );
|
|||||||
* @param out output stream
|
* @param out output stream
|
||||||
* @param b bucket
|
* @param b bucket
|
||||||
*/
|
*/
|
||||||
inline ostream&
|
inline std::ostream&
|
||||||
operator<< ( ostream& out, const SGBucket& b )
|
operator<< ( std::ostream& out, const SGBucket& b )
|
||||||
{
|
{
|
||||||
return out << b.lon << ":" << b.x << ", " << b.lat << ":" << b.y;
|
return out << b.lon << ":" << (int)b.x << ", " << b.lat << ":" << (int)b.y;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -1,2 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
+65
-342
@@ -11,10 +11,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
*
|
*
|
||||||
@@ -24,48 +23,9 @@
|
|||||||
* A set of defines to encapsulate compiler and platform differences.
|
* A set of defines to encapsulate compiler and platform differences.
|
||||||
* Please refer to the source code for full documentation on this file.
|
* Please refer to the source code for full documentation on this file.
|
||||||
*
|
*
|
||||||
* Here is a summary of what this file does.
|
* This file is useful to set compiler-specific options in every file - for
|
||||||
|
* example, disabling warnings.
|
||||||
*
|
*
|
||||||
* (1) Defines macros for some STL includes which may be affected
|
|
||||||
* by file name length limitations.
|
|
||||||
*
|
|
||||||
* (2) Defines macros for some features not supported by all C++ compilers.
|
|
||||||
*
|
|
||||||
* (3) Defines 'explicit' as a null macro if the compiler doesn't support
|
|
||||||
* the explicit keyword.
|
|
||||||
*
|
|
||||||
* (4) Defines 'typename' as a null macro if the compiler doesn't support
|
|
||||||
* the typename keyword.
|
|
||||||
*
|
|
||||||
* (5) Defines bool, true and false if the compiler doesn't do so.
|
|
||||||
*
|
|
||||||
* (6) Defines SG_EXPLICIT_FUNCTION_TMPL_ARGS if the compiler
|
|
||||||
* supports calling a function template by providing its template
|
|
||||||
* arguments explicitly.
|
|
||||||
*
|
|
||||||
* (7) Defines SG_NEED_AUTO_PTR if STL doesn't provide auto_ptr<>.
|
|
||||||
*
|
|
||||||
* (8) Defines SG_NO_ARROW_OPERATOR if the compiler is unable
|
|
||||||
* to support operator->() for iterators.
|
|
||||||
*
|
|
||||||
* (9) Defines SG_USE_EXCEPTIONS if the compiler supports exceptions.
|
|
||||||
* Note: no FlightGear code uses exceptions.
|
|
||||||
*
|
|
||||||
* (10) Define SG_NAMESPACES if the compiler supports namespaces.
|
|
||||||
*
|
|
||||||
* (11) SG_MATH_FN_IN_NAMESPACE_STD -- not used??
|
|
||||||
*
|
|
||||||
* (12) Define SG_HAVE_STD if std namespace is supported.
|
|
||||||
*
|
|
||||||
* (13) Defines SG_CLASS_PARTIAL_SPECIALIZATION if the compiler
|
|
||||||
* supports partial specialization of class templates.
|
|
||||||
*
|
|
||||||
* (14) Defines SG_HAVE_STD_INCLUDES to use ISO C++ Standard headers.
|
|
||||||
*
|
|
||||||
* (15) Defines SG_HAVE_STREAMBUF if <streambuf> of <streambuf.h> are present.
|
|
||||||
*
|
|
||||||
* (16) Define SG_MATH_EXCEPTION_CLASH if math.h defines an exception class
|
|
||||||
* that clashes with the one defined in <stdexcept>.
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef _SG_COMPILER_H
|
#ifndef _SG_COMPILER_H
|
||||||
@@ -80,157 +40,37 @@
|
|||||||
#define SG_DO_STRINGIZE(X) #X
|
#define SG_DO_STRINGIZE(X) #X
|
||||||
|
|
||||||
#ifdef __GNUC__
|
#ifdef __GNUC__
|
||||||
# if __GNUC__ == 2
|
# if __GNUC__ < 3
|
||||||
# if __GNUC_MINOR__ < 8
|
# error Time to upgrade. GNU compilers < 3.0 not supported
|
||||||
|
# elif (__GNUC__ == 3) && (__GNUC_MINOR__ < 4)
|
||||||
// g++-2.7.x
|
# warning GCC compilers prior to 3.4 are suspect
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip.h>
|
|
||||||
# define STL_IOSTREAM <iostream.h>
|
|
||||||
# define STL_ITERATOR <iterator.h>
|
|
||||||
# define STL_FSTREAM <fstream.h>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define STL_STRSTREAM <strstream.h>
|
|
||||||
|
|
||||||
# define SG_NEED_AUTO_PTR
|
|
||||||
# define SG_NO_DEFAULT_TEMPLATE_ARGS
|
|
||||||
# define SG_INCOMPLETE_FUNCTIONAL
|
|
||||||
# define SG_NO_ARROW_OPERATOR
|
|
||||||
|
|
||||||
# elif __GNUC_MINOR__ >= 8
|
|
||||||
|
|
||||||
// g++-2.8.x and egcs-1.x
|
|
||||||
# define SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
|
||||||
# define SG_NEED_AUTO_PTR
|
|
||||||
# define SG_MEMBER_TEMPLATES
|
|
||||||
# define SG_NAMESPACES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_HAVE_STREAMBUF
|
|
||||||
# define SG_CLASS_PARTIAL_SPECIALIZATION
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
|
|
||||||
# endif
|
|
||||||
# elif __GNUC__ >= 3
|
|
||||||
// g++-3.0.x
|
|
||||||
# define SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
|
||||||
# define SG_NEED_AUTO_PTR
|
|
||||||
# define SG_MEMBER_TEMPLATES
|
|
||||||
# define SG_NAMESPACES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_HAVE_STREAMBUF
|
|
||||||
# define SG_CLASS_PARTIAL_SPECIALIZATION
|
|
||||||
# define SG_HAVE_STD_INCLUDES
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
# else
|
|
||||||
# error Time to upgrade. GNU compilers < 2.7 not supported
|
|
||||||
# endif
|
# endif
|
||||||
|
|
||||||
# define SG_COMPILER_STR "GNU C++ version " SG_STRINGIZE(__GNUC__) "." SG_STRINGIZE(__GNUC_MINOR__)
|
# define SG_COMPILER_STR "GNU C++ version " SG_STRINGIZE(__GNUC__) "." SG_STRINGIZE(__GNUC_MINOR__)
|
||||||
|
|
||||||
#endif // __GNUC__
|
#endif // __GNUC__
|
||||||
|
|
||||||
/* KAI C++ */
|
/* KAI C++ */
|
||||||
#if defined(__KCC)
|
#if defined(__KCC)
|
||||||
|
|
||||||
# define SG_NAMESPACES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_HAVE_STREAMBUF
|
|
||||||
# define SG_HAVE_TRAITS
|
|
||||||
# define SG_HAVE_STD_INCLUDES
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
|
|
||||||
# define SG_COMPILER_STR "Kai C++ version " SG_STRINGIZE(__KCC_VERSION)
|
# define SG_COMPILER_STR "Kai C++ version " SG_STRINGIZE(__KCC_VERSION)
|
||||||
|
|
||||||
#endif // __KCC
|
#endif // __KCC
|
||||||
|
|
||||||
//
|
|
||||||
// Metrowerks
|
|
||||||
//
|
|
||||||
#if defined(__MWERKS__)
|
|
||||||
/*
|
|
||||||
CodeWarrior compiler from Metrowerks, Inc.
|
|
||||||
*/
|
|
||||||
# define SG_HAVE_TRAITS
|
|
||||||
# define SG_HAVE_STD_INCLUDES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_NAMESPACES
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
|
|
||||||
// Temp:
|
|
||||||
# define bcopy(from, to, n) memcpy(to, from, n)
|
|
||||||
|
|
||||||
// -rp- please use FG_MEM_COPY everywhere !
|
|
||||||
// #define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
|
|
||||||
|
|
||||||
// -dw- currently used glut has no game mode stuff
|
|
||||||
# define GLUT_WRONG_VERSION
|
|
||||||
|
|
||||||
# define SG_COMPILER_STR "Metrowerks CodeWarrior C++ version " SG_STRINGIZE(__MWERKS__)
|
|
||||||
|
|
||||||
#endif // __MWERKS__
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Microsoft compilers.
|
// Microsoft compilers.
|
||||||
//
|
//
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
# define bcopy(from, to, n) memcpy(to, from, n)
|
# define bcopy(from, to, n) memcpy(to, from, n)
|
||||||
# define FG_MEM_COPY(to,from,n) memcpy(to, from, n)
|
|
||||||
|
|
||||||
# if _MSC_VER >= 1200 // msvc++ 6.0 or greater
|
# if _MSC_VER >= 1200 // msvc++ 6.0 or greater
|
||||||
# define SG_NAMESPACES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_HAVE_STD_INCLUDES
|
|
||||||
# define SG_HAVE_STREAMBUF
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
|
|
||||||
# define isnan _isnan
|
# define isnan _isnan
|
||||||
# define snprintf _snprintf
|
# define snprintf _snprintf
|
||||||
|
# if _MSC_VER < 1500
|
||||||
|
# define vsnprintf _vsnprintf
|
||||||
|
# endif
|
||||||
|
# define copysign _copysign
|
||||||
|
# define strcasecmp stricmp
|
||||||
|
|
||||||
|
# undef min
|
||||||
|
# undef max
|
||||||
|
|
||||||
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
# pragma warning(disable: 4786) // identifier was truncated to '255' characters
|
||||||
# pragma warning(disable: 4244) // conversion from double to float
|
# pragma warning(disable: 4244) // conversion from double to float
|
||||||
@@ -244,79 +84,23 @@
|
|||||||
|
|
||||||
#endif // _MSC_VER
|
#endif // _MSC_VER
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# if defined(HAVE_SGI_STL_PORT)
|
|
||||||
|
|
||||||
// Use quotes around long file names to get around Borland's include hackery
|
|
||||||
|
|
||||||
# define STL_ALGORITHM "algorithm"
|
|
||||||
# define STL_FUNCTIONAL "functional"
|
|
||||||
|
|
||||||
# define SG_MATH_EXCEPTION_CLASH
|
|
||||||
|
|
||||||
# else
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
|
|
||||||
# define SG_INCOMPLETE_FUNCTIONAL
|
|
||||||
|
|
||||||
# endif // HAVE_SGI_STL_PORT
|
|
||||||
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define SG_NO_DEFAULT_TEMPLATE_ARGS
|
|
||||||
# define SG_NAMESPACES
|
|
||||||
// # define SG_HAVE_STD
|
|
||||||
|
|
||||||
# define SG_COMPILER_STR "Borland C++ version " SG_STRINGIZE(__BORLANDC__)
|
|
||||||
|
|
||||||
#endif // __BORLANDC__
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// Native SGI compilers
|
// Native SGI compilers
|
||||||
//
|
//
|
||||||
|
|
||||||
#if defined ( sgi ) && !defined( __GNUC__ )
|
#if defined ( sgi ) && !defined( __GNUC__ )
|
||||||
# define SG_HAVE_NATIVE_SGI_COMPILERS
|
# if (_COMPILER_VERSION < 740)
|
||||||
|
# error Need MipsPro 7.4.0 or higher now
|
||||||
|
# endif
|
||||||
|
|
||||||
# define SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
#define SG_HAVE_NATIVE_SGI_COMPILERS
|
||||||
# define SG_CLASS_PARTIAL_SPECIALIZATION
|
|
||||||
# define SG_NEED_AUTO_PTR
|
|
||||||
# define SG_MEMBER_TEMPLATES
|
|
||||||
# define SG_NAMESPACES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_HAVE_STREAMBUF
|
|
||||||
# define SG_HAVE_TRAITS
|
|
||||||
# define SG_HAVE_STD_INCLUDES
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
#if (_COMPILER_VERSION < 740)
|
|
||||||
# define STL_STRING <irix_string>
|
|
||||||
#else
|
|
||||||
# define STL_STRING <string>
|
|
||||||
#endif
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
|
|
||||||
#pragma set woff 1001,1012,1014,1116,1155,1172,1174
|
#pragma set woff 1001,1012,1014,1116,1155,1172,1174
|
||||||
#pragma set woff 1401,1460,1551,1552,1681
|
#pragma set woff 1401,1460,1551,1552,1681
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
#pragma set woff 1682,3303
|
# pragma set woff 1682,3303
|
||||||
#if (_COMPILER_VERSION >= 740)
|
# pragma set woff 3624
|
||||||
# pragma set woff 3624
|
|
||||||
#endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
# define SG_COMPILER_STR "SGI MipsPro compiler version " SG_STRINGIZE(_COMPILER_VERSION)
|
# define SG_COMPILER_STR "SGI MipsPro compiler version " SG_STRINGIZE(_COMPILER_VERSION)
|
||||||
@@ -324,7 +108,8 @@
|
|||||||
#endif // Native SGI compilers
|
#endif // Native SGI compilers
|
||||||
|
|
||||||
|
|
||||||
#if defined ( sun )
|
#if defined (__sun)
|
||||||
|
# define SG_UNIX
|
||||||
# include <strings.h>
|
# include <strings.h>
|
||||||
# include <memory.h>
|
# include <memory.h>
|
||||||
# if defined ( __cplusplus )
|
# if defined ( __cplusplus )
|
||||||
@@ -346,24 +131,7 @@
|
|||||||
// Intel C++ Compiler
|
// Intel C++ Compiler
|
||||||
//
|
//
|
||||||
#if defined(__ICC) || defined (__ECC)
|
#if defined(__ICC) || defined (__ECC)
|
||||||
# define SG_NAMESPACES
|
|
||||||
# define SG_HAVE_STD
|
|
||||||
# define SG_HAVE_STREAMBUF
|
|
||||||
# define SG_HAVE_TRAITS
|
|
||||||
# define SG_HAVE_STD_INCLUDES
|
|
||||||
|
|
||||||
# define STL_ALGORITHM <algorithm>
|
|
||||||
# define STL_FUNCTIONAL <functional>
|
|
||||||
# define STL_IOMANIP <iomanip>
|
|
||||||
# define STL_IOSTREAM <iostream>
|
|
||||||
# define STL_ITERATOR <iterator>
|
|
||||||
# define STL_FSTREAM <fstream>
|
|
||||||
# define STL_STDEXCEPT <stdexcept>
|
|
||||||
# define STL_STRING <string>
|
|
||||||
# define STL_STRSTREAM <strstream>
|
|
||||||
|
|
||||||
# define SG_COMPILER_STR "Intel C++ version " SG_STRINGIZE(__ICC)
|
# define SG_COMPILER_STR "Intel C++ version " SG_STRINGIZE(__ICC)
|
||||||
|
|
||||||
#endif // __ICC
|
#endif // __ICC
|
||||||
|
|
||||||
//
|
//
|
||||||
@@ -371,96 +139,51 @@
|
|||||||
//
|
//
|
||||||
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
# define SG_GL_H <OpenGL/gl.h>
|
# define SG_MAC
|
||||||
# define SG_GLU_H <OpenGL/glu.h>
|
# define SG_UNIX
|
||||||
# define SG_GLEXT_H <OpenGL/glext.h>
|
# ifdef __GNUC__
|
||||||
# define SG_GLUT_H <GLUT/glut.h>
|
# if ( __GNUC__ > 3 ) || ( __GNUC__ == 3 && __GNUC_MINOR__ >= 3 )
|
||||||
#else
|
inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
|
||||||
# define SG_GL_H <GL/gl.h>
|
# else
|
||||||
# define SG_GLU_H <GL/glu.h>
|
// any C++ header file undefines isinf and isnan
|
||||||
# define SG_GLEXT_H <GL/glext.h>
|
// so this should be included before <iostream>
|
||||||
# define SG_GLUT_H <GL/glut.h>
|
// the functions are STILL in libm (libSystem on mac os x)
|
||||||
|
extern "C" int (isnan)(double);
|
||||||
|
extern "C" int (isinf)(double);
|
||||||
|
# endif
|
||||||
|
# else
|
||||||
|
inline int (isnan)(double r) { return !(r <= 0 || r >= 0); }
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#if defined (__FreeBSD__)
|
||||||
|
# define SG_UNIX
|
||||||
|
#include <sys/param.h>
|
||||||
|
# if __FreeBSD_version < 500000
|
||||||
|
extern "C" {
|
||||||
|
inline int isnan(double r) { return !(r <= 0 || r >= 0); }
|
||||||
|
}
|
||||||
|
# endif
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined (__CYGWIN__)
|
||||||
|
# define SG_WINDOWS
|
||||||
|
# define SG_UNIX
|
||||||
|
# include <ieeefp.h> // isnan
|
||||||
|
#endif
|
||||||
|
|
||||||
|
// includes both MSVC and mingw compilers
|
||||||
|
#if defined(_WIN32) || defined(__WIN32__)
|
||||||
|
# define SG_WINDOWS
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#if defined(__linux__) || defined(_AIX) || defined ( sgi )
|
||||||
|
# define SG_UNIX
|
||||||
|
#endif
|
||||||
|
|
||||||
//
|
//
|
||||||
// No user modifiable definitions beyond here.
|
// No user modifiable definitions beyond here.
|
||||||
//
|
//
|
||||||
|
|
||||||
#ifdef SG_NEED_EXPLICIT
|
|
||||||
# define explicit
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SG_NEED_TYPENAME
|
|
||||||
# define typename
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SG_NEED_MUTABLE
|
|
||||||
# define mutable
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SG_NEED_BOOL
|
|
||||||
typedef int bool;
|
|
||||||
# define true 1
|
|
||||||
# define false 0
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SG_EXPLICIT_FUNCTION_TMPL_ARGS
|
|
||||||
# define SG_NULL_TMPL_ARGS <>
|
|
||||||
#else
|
|
||||||
# define SG_NULL_TMPL_ARGS
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SG_CLASS_PARTIAL_SPECIALIZATION
|
|
||||||
# define SG_TEMPLATE_NULL template<>
|
|
||||||
#else
|
|
||||||
# define SG_TEMPLATE_NULL
|
|
||||||
#endif
|
|
||||||
|
|
||||||
// SG_NO_NAMESPACES is a hook so that users can disable namespaces
|
|
||||||
// without having to edit library headers.
|
|
||||||
#if defined(SG_NAMESPACES) && !defined(SG_NO_NAMESPACES)
|
|
||||||
# define SG_NAMESPACE(X) namespace X {
|
|
||||||
# define SG_NAMESPACE_END }
|
|
||||||
# define SG_USING_NAMESPACE(X) using namespace X
|
|
||||||
# else
|
|
||||||
# define SG_NAMESPACE(X)
|
|
||||||
# define SG_NAMESPACE_END
|
|
||||||
# define SG_USING_NAMESPACE(X)
|
|
||||||
#endif
|
|
||||||
|
|
||||||
/** \def SG_USING_STD(x)
|
|
||||||
* Expands to using std::x if SG_HAVE_STD is defined
|
|
||||||
*/
|
|
||||||
# ifdef SG_HAVE_STD
|
|
||||||
# define SG_USING_STD(X) using std::X
|
|
||||||
# define STD std
|
|
||||||
# else
|
|
||||||
# define SG_USING_STD(X)
|
|
||||||
# define STD
|
|
||||||
# endif
|
|
||||||
|
|
||||||
// Additional <functional> implementation from SGI STL 3.11
|
|
||||||
// Adapter function objects: pointers to member functions
|
|
||||||
#ifdef SG_INCOMPLETE_FUNCTIONAL
|
|
||||||
|
|
||||||
template <class _Ret, class _Tp>
|
|
||||||
class const_mem_fun_ref_t
|
|
||||||
#ifndef __BORLANDC__
|
|
||||||
: public unary_function<_Tp,_Ret>
|
|
||||||
#endif // __BORLANDC__
|
|
||||||
{
|
|
||||||
public:
|
|
||||||
explicit const_mem_fun_ref_t(_Ret (_Tp::*__pf)() const) : _M_f(__pf) {}
|
|
||||||
_Ret operator()(const _Tp& __r) const { return (__r.*_M_f)(); }
|
|
||||||
private:
|
|
||||||
_Ret (_Tp::*_M_f)() const;
|
|
||||||
};
|
|
||||||
|
|
||||||
template <class _Ret, class _Tp>
|
|
||||||
inline const_mem_fun_ref_t<_Ret,_Tp> mem_fun_ref(_Ret (_Tp::*__f)() const)
|
|
||||||
{ return const_mem_fun_ref_t<_Ret,_Tp>(__f); }
|
|
||||||
|
|
||||||
#endif // SG_INCOMPLETE_FUNCTIONAL
|
|
||||||
|
|
||||||
#endif // _SG_COMPILER_H
|
#endif // _SG_COMPILER_H
|
||||||
|
|
||||||
|
|||||||
+40
-22
@@ -14,10 +14,9 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
@@ -32,24 +31,25 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
#include <cmath>
|
||||||
# include <cmath>
|
|
||||||
#else
|
|
||||||
# ifdef SG_MATH_EXCEPTION_CLASH
|
|
||||||
# define exception C_exception
|
|
||||||
# endif
|
|
||||||
# include <math.h>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <plib/sg.h>
|
|
||||||
|
|
||||||
|
|
||||||
// Make sure PI is defined in its various forms
|
// Make sure PI is defined in its various forms
|
||||||
|
|
||||||
// SG_PI and SGD_PI (float and double) come from plib/sg.h
|
#ifndef SGD_PI // remove me once FlightGear no longer uses PLIB
|
||||||
|
|
||||||
|
#ifdef M_PI
|
||||||
|
const double SGD_PI = M_PI;
|
||||||
|
const float SG_PI = M_PI;
|
||||||
|
#else
|
||||||
|
const float SG_PI = 3.1415926535f;
|
||||||
|
const double SGD_PI = 3.1415926535;
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif // of PLIB-SG guard
|
||||||
|
|
||||||
/** 2 * PI */
|
/** 2 * PI */
|
||||||
#define SGD_2PI 6.28318530717958647692
|
const double SGD_2PI = SGD_PI * 2.0;
|
||||||
|
|
||||||
/** PI / 2 */
|
/** PI / 2 */
|
||||||
#ifdef M_PI_2
|
#ifdef M_PI_2
|
||||||
@@ -59,7 +59,17 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
/** PI / 4 */
|
/** PI / 4 */
|
||||||
#define SGD_PI_4 0.78539816339744830961
|
const double SGD_PI_4 = 0.78539816339744830961;
|
||||||
|
|
||||||
|
#ifndef SGD_DEGREES_TO_RADIANS // // remove me once FlightGear no longer uses PLIB
|
||||||
|
|
||||||
|
const double SGD_DEGREES_TO_RADIANS = SGD_PI / 180.0;
|
||||||
|
const double SGD_RADIANS_TO_DEGREES = 180.0 / SGD_PI;
|
||||||
|
|
||||||
|
const float SG_DEGREES_TO_RADIANS = SG_PI / 180.0f;
|
||||||
|
const float SG_RADIANS_TO_DEGREES = 180.0f / SG_PI;
|
||||||
|
|
||||||
|
#endif // of PLIB-SG guard
|
||||||
|
|
||||||
/** \def SG_E "e" */
|
/** \def SG_E "e" */
|
||||||
#ifdef M_E
|
#ifdef M_E
|
||||||
@@ -76,6 +86,8 @@
|
|||||||
* 6378.165 but this is probably close enough */
|
* 6378.165 but this is probably close enough */
|
||||||
#define SG_EARTH_RAD 6378.155
|
#define SG_EARTH_RAD 6378.155
|
||||||
|
|
||||||
|
// Maximum terrain elevation from sea level
|
||||||
|
#define SG_MAX_ELEVATION_M 9000.0
|
||||||
|
|
||||||
// Earth parameters for WGS 84, taken from LaRCsim/ls_constants.h
|
// Earth parameters for WGS 84, taken from LaRCsim/ls_constants.h
|
||||||
|
|
||||||
@@ -123,22 +135,28 @@
|
|||||||
/** Nautical Miles to Radians */
|
/** Nautical Miles to Radians */
|
||||||
#define SG_RAD_TO_NM 3437.7467707849392526
|
#define SG_RAD_TO_NM 3437.7467707849392526
|
||||||
|
|
||||||
/** Miles per second to Knots */
|
/** meters per second to Knots */
|
||||||
#define SG_MPS_TO_KT 1.9438444924406046432
|
#define SG_MPS_TO_KT 1.9438444924406046432
|
||||||
|
|
||||||
/** Knots to Miles per second */
|
/** Knots to meters per second */
|
||||||
#define SG_KT_TO_MPS 0.5144444444444444444
|
#define SG_KT_TO_MPS 0.5144444444444444444
|
||||||
|
|
||||||
/** Miles per second to Miles per hour */
|
/** Feet per second to Knots */
|
||||||
|
#define SG_FPS_TO_KT 0.5924838012958962841
|
||||||
|
|
||||||
|
/** Knots to Feet per second */
|
||||||
|
#define SG_KT_TO_FPS 1.6878098571011956874
|
||||||
|
|
||||||
|
/** meters per second to Miles per hour */
|
||||||
#define SG_MPS_TO_MPH 2.2369362920544020312
|
#define SG_MPS_TO_MPH 2.2369362920544020312
|
||||||
|
|
||||||
/** Miles per hour to Miles per second */
|
/** meetrs per hour to Miles per second */
|
||||||
#define SG_MPH_TO_MPS 0.44704
|
#define SG_MPH_TO_MPS 0.44704
|
||||||
|
|
||||||
/** Meters per second to Kilometers per hour */
|
/** Meters per second to Kilometers per hour */
|
||||||
#define SG_MPS_TO_KMH 3.6
|
#define SG_MPS_TO_KMH 3.6
|
||||||
|
|
||||||
/** Kilometers per hour to Miles per second */
|
/** Kilometers per hour to meters per second */
|
||||||
#define SG_KMH_TO_MPS 0.2777777777777777778
|
#define SG_KMH_TO_MPS 0.2777777777777777778
|
||||||
|
|
||||||
/** Pascal to Inch Mercury */
|
/** Pascal to Inch Mercury */
|
||||||
|
|||||||
@@ -1,3 +0,0 @@
|
|||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS debug_types.h logstream.hxx)
|
||||||
|
set(SOURCES logstream.cxx)
|
||||||
|
|
||||||
|
simgear_component(debug debug "${SOURCES}" "${HEADERS}")
|
||||||
@@ -14,22 +14,37 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
|
|
||||||
#include "logstream.hxx"
|
#include "logstream.hxx"
|
||||||
|
|
||||||
logstream *global_logstream = NULL;
|
logstream *logstream::global_logstream = 0;
|
||||||
|
|
||||||
bool logbuf::logging_enabled = true;
|
bool logbuf::logging_enabled = true;
|
||||||
|
#ifdef _WIN32
|
||||||
|
bool logbuf::has_console = true;
|
||||||
|
#endif
|
||||||
sgDebugClass logbuf::logClass = SG_NONE;
|
sgDebugClass logbuf::logClass = SG_NONE;
|
||||||
sgDebugPriority logbuf::logPriority = SG_INFO;
|
sgDebugPriority logbuf::logPriority = SG_INFO;
|
||||||
streambuf* logbuf::sbuf = NULL;
|
streambuf* logbuf::sbuf = NULL;
|
||||||
|
|
||||||
|
namespace {
|
||||||
|
struct ignore_me
|
||||||
|
{
|
||||||
|
ignore_me()
|
||||||
|
{
|
||||||
|
logstream::initGlobalLogstream();
|
||||||
|
}
|
||||||
|
};
|
||||||
|
static ignore_me im;
|
||||||
|
}
|
||||||
|
|
||||||
logbuf::logbuf()
|
logbuf::logbuf()
|
||||||
{
|
{
|
||||||
// if ( sbuf == NULL )
|
// if ( sbuf == NULL )
|
||||||
@@ -88,3 +103,12 @@ logstream::setLogLevels( sgDebugClass c, sgDebugPriority p )
|
|||||||
logbuf::set_log_level( c, p );
|
logbuf::set_log_level( c, p );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
logstream *
|
||||||
|
logstream::initGlobalLogstream()
|
||||||
|
{
|
||||||
|
// Force initialization of cerr.
|
||||||
|
static std::ios_base::Init initializer;
|
||||||
|
if( !global_logstream )
|
||||||
|
global_logstream = new logstream(std::cerr);
|
||||||
|
return global_logstream;
|
||||||
|
}
|
||||||
|
|||||||
+51
-65
@@ -16,10 +16,9 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
@@ -28,29 +27,18 @@
|
|||||||
|
|
||||||
#include <simgear/compiler.h>
|
#include <simgear/compiler.h>
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
# include <windows.h>
|
# include <windows.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
#include <streambuf>
|
||||||
# include <streambuf>
|
#include <ostream>
|
||||||
# include <iostream>
|
#include <cstdio>
|
||||||
#else
|
|
||||||
# include <iostream.h>
|
|
||||||
# include <simgear/sg_traits.hxx>
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <simgear/debug/debug_types.h>
|
#include <simgear/debug/debug_types.h>
|
||||||
|
|
||||||
SG_USING_STD(streambuf);
|
using std::streambuf;
|
||||||
SG_USING_STD(ostream);
|
using std::ostream;
|
||||||
SG_USING_STD(cout);
|
|
||||||
SG_USING_STD(cerr);
|
|
||||||
SG_USING_STD(endl);
|
|
||||||
|
|
||||||
#ifdef __MWERKS__
|
|
||||||
SG_USING_STD(iostream);
|
|
||||||
#endif
|
|
||||||
|
|
||||||
//
|
//
|
||||||
// TODO:
|
// TODO:
|
||||||
@@ -68,17 +56,10 @@ SG_USING_STD(iostream);
|
|||||||
#ifdef SG_NEED_STREAMBUF_HACK
|
#ifdef SG_NEED_STREAMBUF_HACK
|
||||||
class logbuf : public __streambuf
|
class logbuf : public __streambuf
|
||||||
#else
|
#else
|
||||||
class logbuf : public streambuf
|
class logbuf : public std::streambuf
|
||||||
#endif
|
#endif
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
|
|
||||||
#ifndef SG_HAVE_STD_INCLUDES
|
|
||||||
typedef char_traits<char> traits_type;
|
|
||||||
typedef char_traits<char>::int_type int_type;
|
|
||||||
// typedef char_traits<char>::pos_type pos_type;
|
|
||||||
// typedef char_traits<char>::off_type off_type;
|
|
||||||
#endif
|
|
||||||
// logbuf( streambuf* sb ) : sbuf(sb) {}
|
// logbuf( streambuf* sb ) : sbuf(sb) {}
|
||||||
/** Constructor */
|
/** Constructor */
|
||||||
logbuf();
|
logbuf();
|
||||||
@@ -98,6 +79,8 @@ public:
|
|||||||
*/
|
*/
|
||||||
void set_log_state( sgDebugClass c, sgDebugPriority p );
|
void set_log_state( sgDebugClass c, sgDebugPriority p );
|
||||||
|
|
||||||
|
bool would_log( sgDebugClass c, sgDebugPriority p ) const;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the global logging level.
|
* Set the global logging level.
|
||||||
* @param c debug class
|
* @param c debug class
|
||||||
@@ -138,7 +121,11 @@ public:
|
|||||||
* Set the stream buffer
|
* Set the stream buffer
|
||||||
* @param sb stream buffer
|
* @param sb stream buffer
|
||||||
*/
|
*/
|
||||||
void set_sb( streambuf* sb );
|
void set_sb( std::streambuf* sb );
|
||||||
|
|
||||||
|
#ifdef _WIN32
|
||||||
|
static void has_no_console() { has_console = false; }
|
||||||
|
#endif
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
|
|
||||||
@@ -152,9 +139,12 @@ protected:
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
// The streambuf used for actual output. Defaults to cerr.rdbuf().
|
// The streambuf used for actual output. Defaults to cerr.rdbuf().
|
||||||
static streambuf* sbuf;
|
static std::streambuf* sbuf;
|
||||||
|
|
||||||
static bool logging_enabled;
|
static bool logging_enabled;
|
||||||
|
#ifdef _WIN32
|
||||||
|
static bool has_console;
|
||||||
|
#endif
|
||||||
static sgDebugClass logClass;
|
static sgDebugClass logClass;
|
||||||
static sgDebugPriority logPriority;
|
static sgDebugPriority logPriority;
|
||||||
|
|
||||||
@@ -168,11 +158,7 @@ private:
|
|||||||
inline int
|
inline int
|
||||||
logbuf::sync()
|
logbuf::sync()
|
||||||
{
|
{
|
||||||
#ifdef SG_HAVE_STD_INCLUDES
|
|
||||||
return sbuf->pubsync();
|
return sbuf->pubsync();
|
||||||
#else
|
|
||||||
return sbuf->sync();
|
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline void
|
inline void
|
||||||
@@ -181,11 +167,16 @@ logbuf::set_log_state( sgDebugClass c, sgDebugPriority p )
|
|||||||
logging_enabled = ((c & logClass) != 0 && p >= logPriority);
|
logging_enabled = ((c & logClass) != 0 && p >= logPriority);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline bool
|
||||||
|
logbuf::would_log( sgDebugClass c, sgDebugPriority p ) const
|
||||||
|
{
|
||||||
|
return ((c & logClass) != 0 && p >= logPriority);
|
||||||
|
}
|
||||||
|
|
||||||
inline logbuf::int_type
|
inline logbuf::int_type
|
||||||
logbuf::overflow( int c )
|
logbuf::overflow( int c )
|
||||||
{
|
{
|
||||||
#ifdef _MSC_VER
|
#ifdef _WIN32
|
||||||
static has_console = false;
|
|
||||||
if ( logging_enabled ) {
|
if ( logging_enabled ) {
|
||||||
if ( !has_console ) {
|
if ( !has_console ) {
|
||||||
AllocConsole();
|
AllocConsole();
|
||||||
@@ -194,7 +185,7 @@ logbuf::overflow( int c )
|
|||||||
freopen("conout$", "w", stderr);
|
freopen("conout$", "w", stderr);
|
||||||
has_console = true;
|
has_console = true;
|
||||||
}
|
}
|
||||||
sbuf->sputc(c);
|
return sbuf->sputc(c);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
return EOF == 0 ? 1: 0;
|
return EOF == 0 ? 1: 0;
|
||||||
@@ -233,23 +224,23 @@ struct logstream_base
|
|||||||
/**
|
/**
|
||||||
* Class to manage the debug logging stream.
|
* Class to manage the debug logging stream.
|
||||||
*/
|
*/
|
||||||
class logstream : private logstream_base, public ostream
|
class logstream : private logstream_base, public std::ostream
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
/**
|
/**
|
||||||
* The default is to send messages to cerr.
|
* The default is to send messages to cerr.
|
||||||
* @param out output stream
|
* @param out output stream
|
||||||
*/
|
*/
|
||||||
logstream( ostream& out )
|
logstream( std::ostream& out )
|
||||||
// : logstream_base(out.rdbuf()),
|
// : logstream_base(out.rdbuf()),
|
||||||
: logstream_base(),
|
: logstream_base(),
|
||||||
ostream(&lbuf) { lbuf.set_sb(out.rdbuf());}
|
std::ostream(&lbuf) { lbuf.set_sb(out.rdbuf());}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the output stream
|
* Set the output stream
|
||||||
* @param out output stream
|
* @param out output stream
|
||||||
*/
|
*/
|
||||||
void set_output( ostream& out ) { lbuf.set_sb( out.rdbuf() ); }
|
void set_output( std::ostream& out ) { lbuf.set_sb( out.rdbuf() ); }
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Set the global log class and priority level.
|
* Set the global log class and priority level.
|
||||||
@@ -258,22 +249,29 @@ public:
|
|||||||
*/
|
*/
|
||||||
void setLogLevels( sgDebugClass c, sgDebugPriority p );
|
void setLogLevels( sgDebugClass c, sgDebugPriority p );
|
||||||
|
|
||||||
|
bool would_log( sgDebugClass c, sgDebugPriority p ) const
|
||||||
|
{
|
||||||
|
return lbuf.would_log( c, p );
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Output operator to capture the debug level and priority of a message.
|
* Output operator to capture the debug level and priority of a message.
|
||||||
* @param l log level
|
* @param l log level
|
||||||
*/
|
*/
|
||||||
inline ostream& operator<< ( const loglevel& l );
|
inline std::ostream& operator<< ( const loglevel& l );
|
||||||
|
friend logstream& sglog();
|
||||||
|
static logstream *initGlobalLogstream();
|
||||||
|
protected:
|
||||||
|
static logstream *global_logstream;
|
||||||
};
|
};
|
||||||
|
|
||||||
inline ostream&
|
inline std::ostream&
|
||||||
logstream::operator<< ( const loglevel& l )
|
logstream::operator<< ( const loglevel& l )
|
||||||
{
|
{
|
||||||
lbuf.set_log_state( l.logClass, l.logPriority );
|
lbuf.set_log_state( l.logClass, l.logPriority );
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
extern logstream *global_logstream;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* \relates logstream
|
* \relates logstream
|
||||||
* Return the one and only logstream instance.
|
* Return the one and only logstream instance.
|
||||||
@@ -284,22 +282,7 @@ extern logstream *global_logstream;
|
|||||||
inline logstream&
|
inline logstream&
|
||||||
sglog()
|
sglog()
|
||||||
{
|
{
|
||||||
if (global_logstream == NULL) {
|
return *logstream::initGlobalLogstream();
|
||||||
|
|
||||||
#ifdef __APPLE__
|
|
||||||
/**
|
|
||||||
* There appears to be a bug in the C++ runtime in Mac OS X that
|
|
||||||
* will crash if certain funtions are called (in this case
|
|
||||||
* cerr.rdbuf()) during static initialization of a class. This
|
|
||||||
* print statement is hack to kick the library in the pants so it
|
|
||||||
* won't crash when cerr.rdbuf() is first called -DW
|
|
||||||
**/
|
|
||||||
cout << "Using Mac OS X hack for initializing C++ stdio..." << endl;
|
|
||||||
#endif
|
|
||||||
global_logstream = new logstream (cerr);
|
|
||||||
}
|
|
||||||
|
|
||||||
return *global_logstream;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -311,12 +294,15 @@ sglog()
|
|||||||
*/
|
*/
|
||||||
#ifdef FG_NDEBUG
|
#ifdef FG_NDEBUG
|
||||||
# define SG_LOG(C,P,M)
|
# define SG_LOG(C,P,M)
|
||||||
#elif defined( __MWERKS__ )
|
|
||||||
# define SG_LOG(C,P,M) ::sglog() << ::loglevel(C,P) << M << std::endl
|
|
||||||
#else
|
#else
|
||||||
# define SG_LOG(C,P,M) sglog() << loglevel(C,P) << M << endl
|
# define SG_LOG(C,P,M) do { \
|
||||||
|
logstream& __tmplogstreamref(sglog()); \
|
||||||
|
if(__tmplogstreamref.would_log(C,P)) { \
|
||||||
|
__tmplogstreamref << loglevel(C,P) << M << std::endl; } \
|
||||||
|
} while(0)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define SG_ORIGIN __FILE__ ":" SG_STRINGIZE(__LINE__)
|
||||||
|
|
||||||
#endif // _LOGSTREAM_H
|
#endif // _LOGSTREAM_H
|
||||||
|
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
#include <string>
|
#include <string>
|
||||||
#include "Debug/logstream.hxx"
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
class Test {
|
class Test {
|
||||||
|
|
||||||
|
|||||||
@@ -1,4 +0,0 @@
|
|||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
metar
|
|
||||||
@@ -0,0 +1,7 @@
|
|||||||
|
|
||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS metar.hxx precipitation.hxx)
|
||||||
|
set(SOURCES metar.cxx precipitation.cxx)
|
||||||
|
|
||||||
|
simgear_component(environment environment "${SOURCES}" "${HEADERS}")
|
||||||
@@ -2,8 +2,8 @@ includedir = @includedir@/environment
|
|||||||
|
|
||||||
lib_LIBRARIES = libsgenvironment.a
|
lib_LIBRARIES = libsgenvironment.a
|
||||||
|
|
||||||
include_HEADERS = metar.hxx
|
include_HEADERS = metar.hxx precipitation.hxx
|
||||||
|
|
||||||
libsgenvironment_a_SOURCES = metar.cxx
|
libsgenvironment_a_SOURCES = metar.cxx precipitation.cxx
|
||||||
|
|
||||||
INCLUDES = -I$(top_srcdir)
|
INCLUDES = -I$(top_srcdir)
|
||||||
|
|||||||
+218
-114
@@ -16,7 +16,7 @@
|
|||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
@@ -24,8 +24,13 @@
|
|||||||
* @file metar.cxx
|
* @file metar.cxx
|
||||||
* Interface for encoded Meteorological Aerodrome Reports (METAR).
|
* Interface for encoded Meteorological Aerodrome Reports (METAR).
|
||||||
*/
|
*/
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <string>
|
#include <string>
|
||||||
|
#include <time.h>
|
||||||
|
#include <cstring>
|
||||||
|
|
||||||
#include <simgear/io/sg_socket.hxx>
|
#include <simgear/io/sg_socket.hxx>
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
@@ -59,8 +64,10 @@
|
|||||||
* double d = n.getDewpoint_C();
|
* double d = n.getDewpoint_C();
|
||||||
* @endcode
|
* @endcode
|
||||||
*/
|
*/
|
||||||
SGMetar::SGMetar(const string& m, const string& proxy, const string& port, const string& auth) :
|
SGMetar::SGMetar(const string& m, const string& proxy, const string& port,
|
||||||
|
const string& auth, const time_t time) :
|
||||||
_grpcount(0),
|
_grpcount(0),
|
||||||
|
_x_proxy(false),
|
||||||
_year(-1),
|
_year(-1),
|
||||||
_month(-1),
|
_month(-1),
|
||||||
_day(-1),
|
_day(-1),
|
||||||
@@ -74,13 +81,17 @@ SGMetar::SGMetar(const string& m, const string& proxy, const string& port, const
|
|||||||
_wind_range_to(-1),
|
_wind_range_to(-1),
|
||||||
_temp(NaN),
|
_temp(NaN),
|
||||||
_dewp(NaN),
|
_dewp(NaN),
|
||||||
_pressure(NaN)
|
_pressure(NaN),
|
||||||
|
_rain(false),
|
||||||
|
_hail(false),
|
||||||
|
_snow(false),
|
||||||
|
_cavok(false)
|
||||||
{
|
{
|
||||||
if (m.length() == 4 && isalnum(m[0]) && isalnum(m[1]) && isalnum(m[2]) && isalnum(m[3])) {
|
if (m.length() == 4 && isalnum(m[0]) && isalnum(m[1]) && isalnum(m[2]) && isalnum(m[3])) {
|
||||||
for (int i = 0; i < 4; i++)
|
for (int i = 0; i < 4; i++)
|
||||||
_icao[i] = toupper(m[i]);
|
_icao[i] = toupper(m[i]);
|
||||||
_icao[4] = '\0';
|
_icao[4] = '\0';
|
||||||
_data = loadData(_icao, proxy, port, auth);
|
_data = loadData(_icao, proxy, port, auth, time);
|
||||||
} else {
|
} else {
|
||||||
_data = new char[m.length() + 2]; // make room for " \0"
|
_data = new char[m.length() + 2]; // make room for " \0"
|
||||||
strcpy(_data, m.c_str());
|
strcpy(_data, m.c_str());
|
||||||
@@ -92,14 +103,15 @@ SGMetar::SGMetar(const string& m, const string& proxy, const string& port, const
|
|||||||
_icao[0] = '\0';
|
_icao[0] = '\0';
|
||||||
|
|
||||||
// NOAA preample
|
// NOAA preample
|
||||||
scanPreambleDate();
|
if (!scanPreambleDate())
|
||||||
|
useCurrentDate();
|
||||||
scanPreambleTime();
|
scanPreambleTime();
|
||||||
|
|
||||||
// METAR header
|
// METAR header
|
||||||
scanType();
|
scanType();
|
||||||
if (!scanId() || !scanDate()) {
|
if (!scanId() || !scanDate()) {
|
||||||
delete[] _data;
|
delete[] _data;
|
||||||
throw sg_io_exception("metar data bogus (" + _url + ')');
|
throw sg_io_exception("metar data bogus ", sg_location(_url));
|
||||||
}
|
}
|
||||||
scanModifier();
|
scanModifier();
|
||||||
|
|
||||||
@@ -125,8 +137,9 @@ SGMetar::SGMetar(const string& m, const string& proxy, const string& port, const
|
|||||||
|
|
||||||
if (_grpcount < 4) {
|
if (_grpcount < 4) {
|
||||||
delete[] _data;
|
delete[] _data;
|
||||||
throw sg_io_exception("metar data incomplete (" + _url + ')');
|
throw sg_io_exception("metar data incomplete ", sg_location(_url));
|
||||||
}
|
}
|
||||||
|
|
||||||
_url = "";
|
_url = "";
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -143,6 +156,20 @@ SGMetar::~SGMetar()
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SGMetar::useCurrentDate()
|
||||||
|
{
|
||||||
|
struct tm now;
|
||||||
|
time_t now_sec = time(0);
|
||||||
|
#ifdef _WIN32
|
||||||
|
now = *gmtime(&now_sec);
|
||||||
|
#else
|
||||||
|
gmtime_r(&now_sec, &now);
|
||||||
|
#endif
|
||||||
|
_year = now.tm_year + 1900;
|
||||||
|
_month = now.tm_mon + 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* If called with "KSFO" loads data from
|
* If called with "KSFO" loads data from
|
||||||
* @code
|
* @code
|
||||||
@@ -157,41 +184,49 @@ SGMetar::~SGMetar()
|
|||||||
* @return pointer to Metar data string, allocated by new char[].
|
* @return pointer to Metar data string, allocated by new char[].
|
||||||
* @see rfc2068.txt for proxy spec ("Proxy-Authorization")
|
* @see rfc2068.txt for proxy spec ("Proxy-Authorization")
|
||||||
*/
|
*/
|
||||||
char *SGMetar::loadData(const char *id, const string& proxy, const string& port, const string& auth)
|
char *SGMetar::loadData(const char *id, const string& proxy, const string& port,
|
||||||
|
const string& auth, time_t time)
|
||||||
{
|
{
|
||||||
string host = proxy.empty() ? "weather.noaa.gov" : proxy;
|
const int buflen = 512;
|
||||||
|
char buf[2 * buflen];
|
||||||
|
|
||||||
|
string metar_server = "weather.noaa.gov";
|
||||||
|
string host = proxy.empty() ? metar_server : proxy;
|
||||||
string path = "/pub/data/observations/metar/stations/";
|
string path = "/pub/data/observations/metar/stations/";
|
||||||
|
|
||||||
path += string(id) + ".TXT";
|
path += string(id) + ".TXT";
|
||||||
_url = "http://weather.noaa.gov" + path;
|
_url = "http://" + metar_server + path;
|
||||||
|
|
||||||
SGSocket *sock = new SGSocket(host, port.empty() ? "80" : port, "tcp");
|
SGSocket *sock = new SGSocket(host, port.empty() ? "80" : port, "tcp");
|
||||||
sock->set_timeout(10000);
|
sock->set_timeout(10000);
|
||||||
if (!sock->open(SG_IO_OUT)) {
|
if (!sock->open(SG_IO_OUT)) {
|
||||||
delete sock;
|
delete sock;
|
||||||
throw sg_io_exception("cannot connect to " + host);
|
throw sg_io_exception("cannot connect to ", sg_location(host));
|
||||||
}
|
}
|
||||||
|
|
||||||
string get = "GET ";
|
string get = "GET ";
|
||||||
if (!proxy.empty())
|
if (!proxy.empty())
|
||||||
get += "http://weather.noaa.gov";
|
get += "http://" + metar_server;
|
||||||
get += path + " HTTP/1.0\r\n";
|
|
||||||
|
sprintf(buf, "%ld", time);
|
||||||
|
get += path + " HTTP/1.0\015\012X-Time: " + buf + "\015\012";
|
||||||
|
get += "Host: " + metar_server + "\015\012";
|
||||||
|
|
||||||
|
if (!auth.empty())
|
||||||
|
get += "Proxy-Authorization: " + auth + "\015\012";
|
||||||
|
|
||||||
|
get += "\015\012";
|
||||||
sock->writestring(get.c_str());
|
sock->writestring(get.c_str());
|
||||||
|
|
||||||
if (!auth.empty()) {
|
|
||||||
get = "Proxy-Authorization: " + auth + "\r\n";
|
|
||||||
sock->writestring(get.c_str());
|
|
||||||
}
|
|
||||||
|
|
||||||
sock->writestring("\r\n");
|
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
const int buflen = 512;
|
|
||||||
char buf[2 * buflen];
|
|
||||||
|
|
||||||
// skip HTTP header
|
// skip HTTP header
|
||||||
while ((i = sock->readline(buf, buflen)))
|
while ((i = sock->readline(buf, buflen))) {
|
||||||
if (i <= 2 && isspace(buf[0]) && (!buf[1] || isspace(buf[1])))
|
if (i <= 2 && isspace(buf[0]) && (!buf[1] || isspace(buf[1])))
|
||||||
break;
|
break;
|
||||||
|
if (!strncmp(buf, "X-MetarProxy: ", 13))
|
||||||
|
_x_proxy = true;
|
||||||
|
}
|
||||||
if (i) {
|
if (i) {
|
||||||
i = sock->readline(buf, buflen);
|
i = sock->readline(buf, buflen);
|
||||||
if (i)
|
if (i)
|
||||||
@@ -204,7 +239,8 @@ char *SGMetar::loadData(const char *id, const string& proxy, const string& port,
|
|||||||
char *b = buf;
|
char *b = buf;
|
||||||
scanBoundary(&b);
|
scanBoundary(&b);
|
||||||
if (*b == '<')
|
if (*b == '<')
|
||||||
throw sg_io_exception("no metar data available from " + _url);
|
throw sg_io_exception("no metar data available from ",
|
||||||
|
sg_location(_url));
|
||||||
|
|
||||||
char *metar = new char[strlen(b) + 2]; // make room for " \0"
|
char *metar = new char[strlen(b) + 2]; // make room for " \0"
|
||||||
strcpy(metar, b);
|
strcpy(metar, b);
|
||||||
@@ -392,7 +428,7 @@ bool SGMetar::scanWind()
|
|||||||
if (gust != NaN)
|
if (gust != NaN)
|
||||||
_gust_speed = gust * factor;
|
_gust_speed = gust * factor;
|
||||||
_grpcount++;
|
_grpcount++;
|
||||||
return false;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -432,11 +468,13 @@ bool SGMetar::scanVisibility()
|
|||||||
int modifier = SGMetarVisibility::EQUALS;
|
int modifier = SGMetarVisibility::EQUALS;
|
||||||
// \d{4}(N|NE|E|SE|S|SW|W|NW)?
|
// \d{4}(N|NE|E|SE|S|SW|W|NW)?
|
||||||
if (scanNumber(&m, &i, 4)) {
|
if (scanNumber(&m, &i, 4)) {
|
||||||
if (*m == 'E')
|
if( strncmp( m, "NDV",3 ) == 0 ) {
|
||||||
|
m+=3; // tolerate NDV (no directional validation)
|
||||||
|
} else if (*m == 'E') {
|
||||||
m++, dir = 90;
|
m++, dir = 90;
|
||||||
else if (*m == 'W')
|
} else if (*m == 'W') {
|
||||||
m++, dir = 270;
|
m++, dir = 270;
|
||||||
else if (*m == 'N') {
|
} else if (*m == 'N') {
|
||||||
m++;
|
m++;
|
||||||
if (*m == 'E')
|
if (*m == 'E')
|
||||||
m++, dir = 45;
|
m++, dir = 45;
|
||||||
@@ -452,7 +490,7 @@ bool SGMetar::scanVisibility()
|
|||||||
m++, dir = 225;
|
m++, dir = 225;
|
||||||
else
|
else
|
||||||
dir = 180;
|
dir = 180;
|
||||||
}
|
}
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
i = 50, modifier = SGMetarVisibility::LESS_THAN;
|
i = 50, modifier = SGMetarVisibility::LESS_THAN;
|
||||||
else if (i == 9999)
|
else if (i == 9999)
|
||||||
@@ -460,7 +498,6 @@ bool SGMetar::scanVisibility()
|
|||||||
distance = i;
|
distance = i;
|
||||||
} else {
|
} else {
|
||||||
// M?(\d{1,2}|\d{1,2}/\d{1,2}|\d{1,2} \d{1,2}/\d{1,2})(SM|KM)
|
// M?(\d{1,2}|\d{1,2}/\d{1,2}|\d{1,2} \d{1,2}/\d{1,2})(SM|KM)
|
||||||
modifier = 0;
|
|
||||||
if (*m == 'M')
|
if (*m == 'M')
|
||||||
m++, modifier = SGMetarVisibility::LESS_THAN;
|
m++, modifier = SGMetarVisibility::LESS_THAN;
|
||||||
|
|
||||||
@@ -559,7 +596,7 @@ bool SGMetar::scanRwyVisRange()
|
|||||||
r._max_visibility._distance = to;
|
r._max_visibility._distance = to;
|
||||||
|
|
||||||
if (*m == '/') // this is not in the spec!
|
if (*m == '/') // this is not in the spec!
|
||||||
*m++;
|
m++;
|
||||||
if (*m == 'D')
|
if (*m == 'D')
|
||||||
m++, r._min_visibility._tendency = SGMetarVisibility::DECREASING;
|
m++, r._min_visibility._tendency = SGMetarVisibility::DECREASING;
|
||||||
else if (*m == 'N')
|
else if (*m == 'N')
|
||||||
@@ -579,61 +616,62 @@ bool SGMetar::scanRwyVisRange()
|
|||||||
|
|
||||||
|
|
||||||
static const struct Token special[] = {
|
static const struct Token special[] = {
|
||||||
"NSW", "no significant weather",
|
{ "NSW", "no significant weather" },
|
||||||
"VCSH", "showers in the vicinity",
|
/* { "VCSH", "showers in the vicinity" },
|
||||||
"VCTS", "thunderstorm in the vicinity",
|
{ "VCTS", "thunderstorm in the vicinity" }, */
|
||||||
0, 0
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct Token description[] = {
|
static const struct Token description[] = {
|
||||||
"SH", "showers of",
|
{ "SH", "showers of" },
|
||||||
"TS", "thunderstorm with",
|
{ "TS", "thunderstorm with" },
|
||||||
"BC", "patches of",
|
{ "BC", "patches of" },
|
||||||
"BL", "blowing",
|
{ "BL", "blowing" },
|
||||||
"DR", "low drifting",
|
{ "DR", "low drifting" },
|
||||||
"FZ", "freezing",
|
{ "FZ", "freezing" },
|
||||||
"MI", "shallow",
|
{ "MI", "shallow" },
|
||||||
"PR", "partial",
|
{ "PR", "partial" },
|
||||||
0, 0
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
static const struct Token phenomenon[] = {
|
static const struct Token phenomenon[] = {
|
||||||
"DZ", "drizzle",
|
{ "DZ", "drizzle" },
|
||||||
"GR", "hail",
|
{ "GR", "hail" },
|
||||||
"GS", "small hail and/or snow pellets",
|
{ "GS", "small hail and/or snow pellets" },
|
||||||
"IC", "ice crystals",
|
{ "IC", "ice crystals" },
|
||||||
"PE", "ice pellets",
|
{ "PE", "ice pellets" },
|
||||||
"RA", "rain",
|
{ "RA", "rain" },
|
||||||
"SG", "snow grains",
|
{ "SG", "snow grains" },
|
||||||
"SN", "snow",
|
{ "SN", "snow" },
|
||||||
"UP", "unknown precipitation",
|
{ "UP", "unknown precipitation" },
|
||||||
"BR", "mist",
|
{ "BR", "mist" },
|
||||||
"DU", "widespread dust",
|
{ "DU", "widespread dust" },
|
||||||
"SG", "fog",
|
{ "FG", "fog" },
|
||||||
"SGBR", "fog bank",
|
{ "FGBR", "fog bank" },
|
||||||
"FU", "smoke",
|
{ "FU", "smoke" },
|
||||||
"HZ", "haze",
|
{ "HZ", "haze" },
|
||||||
"PY", "spray",
|
{ "PY", "spray" },
|
||||||
"SA", "sand",
|
{ "SA", "sand" },
|
||||||
"VA", "volcanic ash",
|
{ "VA", "volcanic ash" },
|
||||||
"DS", "duststorm",
|
{ "DS", "duststorm" },
|
||||||
"FC", "funnel cloud/tornado waterspout",
|
{ "FC", "funnel cloud/tornado waterspout" },
|
||||||
"PO", "well-developed dust/sand whirls",
|
{ "PO", "well-developed dust/sand whirls" },
|
||||||
"SQ", "squalls",
|
{ "SQ", "squalls" },
|
||||||
"SS", "sandstorm",
|
{ "SS", "sandstorm" },
|
||||||
"UP", "unknown", // ... due to failed automatic acquisition
|
{ "UP", "unknown" }, // ... due to failed automatic acquisition
|
||||||
0, 0
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
// (+|-|VC)?(NSW|MI|PR|BC|DR|BL|SH|TS|FZ)?((DZ|RA|SN|SG|IC|PE|GR|GS|UP){0,3})(BR|SG|FU|VA|DU|SA|HZ|PY|PO|SQ|FC|SS|DS){0,3}
|
// (+|-|VC)?(NSW|MI|PR|BC|DR|BL|SH|TS|FZ)?((DZ|RA|SN|SG|IC|PE|GR|GS|UP){0,3})(BR|FG|FU|VA|DU|SA|HZ|PY|PO|SQ|FC|SS|DS){0,3}
|
||||||
bool SGMetar::scanWeather()
|
bool SGMetar::scanWeather()
|
||||||
{
|
{
|
||||||
char *m = _m;
|
char *m = _m;
|
||||||
string weather;
|
string weather;
|
||||||
const struct Token *a;
|
const struct Token *a;
|
||||||
|
|
||||||
if ((a = scanToken(&m, special))) {
|
if ((a = scanToken(&m, special))) {
|
||||||
if (!scanBoundary(&m))
|
if (!scanBoundary(&m))
|
||||||
return false;
|
return false;
|
||||||
@@ -643,25 +681,35 @@ bool SGMetar::scanWeather()
|
|||||||
}
|
}
|
||||||
|
|
||||||
string pre, post;
|
string pre, post;
|
||||||
|
struct Weather w;
|
||||||
if (*m == '-')
|
if (*m == '-')
|
||||||
m++, pre = "light ";
|
m++, pre = "light ", w.intensity = LIGHT;
|
||||||
else if (*m == '+')
|
else if (*m == '+')
|
||||||
m++, pre = "heavy ";
|
m++, pre = "heavy ", w.intensity = HEAVY;
|
||||||
else if (!strncmp(m, "VC", 2))
|
else if (!strncmp(m, "VC", 2))
|
||||||
m += 2, post = "in the vicinity ";
|
m += 2, post = "in the vicinity ", w.vincinity=true;
|
||||||
else
|
else
|
||||||
pre = "moderate ";
|
pre = "moderate ", w.intensity = MODERATE;
|
||||||
|
|
||||||
int i;
|
int i;
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (!(a = scanToken(&m, description)))
|
if (!(a = scanToken(&m, description)))
|
||||||
break;
|
break;
|
||||||
|
w.descriptions.push_back(a->id);
|
||||||
weather += string(a->text) + " ";
|
weather += string(a->text) + " ";
|
||||||
}
|
}
|
||||||
|
|
||||||
for (i = 0; i < 3; i++) {
|
for (i = 0; i < 3; i++) {
|
||||||
if (!(a = scanToken(&m, phenomenon)))
|
if (!(a = scanToken(&m, phenomenon)))
|
||||||
break;
|
break;
|
||||||
|
w.phenomena.push_back(a->id);
|
||||||
weather += string(a->text) + " ";
|
weather += string(a->text) + " ";
|
||||||
|
if (!strcmp(a->id, "RA"))
|
||||||
|
_rain = w.intensity;
|
||||||
|
else if (!strcmp(a->id, "HA"))
|
||||||
|
_hail = w.intensity;
|
||||||
|
else if (!strcmp(a->id, "SN"))
|
||||||
|
_snow = w.intensity;
|
||||||
}
|
}
|
||||||
if (!weather.length())
|
if (!weather.length())
|
||||||
return false;
|
return false;
|
||||||
@@ -671,35 +719,37 @@ bool SGMetar::scanWeather()
|
|||||||
weather = pre + weather + post;
|
weather = pre + weather + post;
|
||||||
weather.erase(weather.length() - 1);
|
weather.erase(weather.length() - 1);
|
||||||
_weather.push_back(weather);
|
_weather.push_back(weather);
|
||||||
|
if( w.phenomena.size() > 0 )
|
||||||
|
_weather2.push_back( w );
|
||||||
_grpcount++;
|
_grpcount++;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static const struct Token cloud_types[] = {
|
static const struct Token cloud_types[] = {
|
||||||
"AC", "altocumulus",
|
{ "AC", "altocumulus" },
|
||||||
"ACC", "altocumulus castellanus",
|
{ "ACC", "altocumulus castellanus" },
|
||||||
"ACSL", "altocumulus standing lenticular",
|
{ "ACSL", "altocumulus standing lenticular" },
|
||||||
"AS", "altostratus",
|
{ "AS", "altostratus" },
|
||||||
"CB", "cumulonimbus",
|
{ "CB", "cumulonimbus" },
|
||||||
"CBMAM", "cumulonimbus mammatus",
|
{ "CBMAM", "cumulonimbus mammatus" },
|
||||||
"CC", "cirrocumulus",
|
{ "CC", "cirrocumulus" },
|
||||||
"CCSL", "cirrocumulus standing lenticular",
|
{ "CCSL", "cirrocumulus standing lenticular" },
|
||||||
"CI", "cirrus",
|
{ "CI", "cirrus" },
|
||||||
"CS", "cirrostratus",
|
{ "CS", "cirrostratus" },
|
||||||
"CU", "cumulus",
|
{ "CU", "cumulus" },
|
||||||
"CUFRA", "cumulus fractus",
|
{ "CUFRA", "cumulus fractus" },
|
||||||
"NS", "nimbostratus",
|
{ "NS", "nimbostratus" },
|
||||||
"SAC", "stratoaltocumulus", // guessed
|
{ "SAC", "stratoaltocumulus" }, // guessed
|
||||||
"SC", "stratocumulus",
|
{ "SC", "stratocumulus" },
|
||||||
"SCSL", "stratocumulus standing lenticular",
|
{ "SCSL", "stratocumulus standing lenticular" },
|
||||||
"ST", "stratus",
|
{ "ST", "stratus" },
|
||||||
"STFRA", "stratus fractus",
|
{ "STFRA", "stratus fractus" },
|
||||||
"TCU", "towering cumulus",
|
{ "TCU", "towering cumulus" },
|
||||||
0, 0
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
#include <iostream>
|
||||||
// (FEW|SCT|BKN|OVC|SKC|CLR|CAVOK|VV)([0-9]{3}|///)?[:cloud_type:]?
|
// (FEW|SCT|BKN|OVC|SKC|CLR|CAVOK|VV)([0-9]{3}|///)?[:cloud_type:]?
|
||||||
bool SGMetar::scanSkyCondition()
|
bool SGMetar::scanSkyCondition()
|
||||||
{
|
{
|
||||||
@@ -707,15 +757,29 @@ bool SGMetar::scanSkyCondition()
|
|||||||
int i;
|
int i;
|
||||||
SGMetarCloud cl;
|
SGMetarCloud cl;
|
||||||
|
|
||||||
|
if (!strncmp(m, "//////", 6)) {
|
||||||
|
m += 6;
|
||||||
|
if (!scanBoundary(&m))
|
||||||
|
return false;
|
||||||
|
_m = m;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
if (!strncmp(m, "CLR", i = 3) // clear
|
if (!strncmp(m, "CLR", i = 3) // clear
|
||||||
|| !strncmp(m, "SKC", i = 3) // sky clear
|
|| !strncmp(m, "SKC", i = 3) // sky clear
|
||||||
|
|| !strncmp(m, "NCD", i = 3) // nil cloud detected
|
||||||
|| !strncmp(m, "NSC", i = 3) // no significant clouds
|
|| !strncmp(m, "NSC", i = 3) // no significant clouds
|
||||||
|| !strncmp(m, "CAVOK", i = 5)) { // ceiling and visibility OK (implies 9999)
|
|| !strncmp(m, "CAVOK", i = 5)) { // ceiling and visibility OK (implies 9999)
|
||||||
m += i;
|
m += i;
|
||||||
if (!scanBoundary(&m))
|
if (!scanBoundary(&m))
|
||||||
return false;
|
return false;
|
||||||
cl._coverage = 0;
|
|
||||||
_clouds.push_back(cl);
|
if (i == 3) {
|
||||||
|
cl._coverage = SGMetarCloud::COVERAGE_CLEAR;
|
||||||
|
_clouds.push_back(cl);
|
||||||
|
} else {
|
||||||
|
_cavok = true;
|
||||||
|
}
|
||||||
_m = m;
|
_m = m;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
@@ -723,13 +787,13 @@ bool SGMetar::scanSkyCondition()
|
|||||||
if (!strncmp(m, "VV", i = 2)) // vertical visibility
|
if (!strncmp(m, "VV", i = 2)) // vertical visibility
|
||||||
;
|
;
|
||||||
else if (!strncmp(m, "FEW", i = 3))
|
else if (!strncmp(m, "FEW", i = 3))
|
||||||
cl._coverage = 1;
|
cl._coverage = SGMetarCloud::COVERAGE_FEW;
|
||||||
else if (!strncmp(m, "SCT", i = 3))
|
else if (!strncmp(m, "SCT", i = 3))
|
||||||
cl._coverage = 2;
|
cl._coverage = SGMetarCloud::COVERAGE_SCATTERED;
|
||||||
else if (!strncmp(m, "BKN", i = 3))
|
else if (!strncmp(m, "BKN", i = 3))
|
||||||
cl._coverage = 3;
|
cl._coverage = SGMetarCloud::COVERAGE_BROKEN;
|
||||||
else if (!strncmp(m, "OVC", i = 3))
|
else if (!strncmp(m, "OVC", i = 3))
|
||||||
cl._coverage = 4;
|
cl._coverage = SGMetarCloud::COVERAGE_OVERCAST;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
m += i;
|
m += i;
|
||||||
@@ -742,7 +806,7 @@ bool SGMetar::scanSkyCondition()
|
|||||||
} else if (!scanNumber(&m, &i, 3))
|
} else if (!scanNumber(&m, &i, 3))
|
||||||
i = -1;
|
i = -1;
|
||||||
|
|
||||||
if (cl._coverage == -1) {
|
if (cl._coverage == SGMetarCloud::COVERAGE_NIL) {
|
||||||
if (!scanBoundary(&m))
|
if (!scanBoundary(&m))
|
||||||
return false;
|
return false;
|
||||||
if (i == -1) // 'VV///'
|
if (i == -1) // 'VV///'
|
||||||
@@ -791,7 +855,7 @@ bool SGMetar::scanTemperature()
|
|||||||
return false;
|
return false;
|
||||||
if (!scanBoundary(&m)) {
|
if (!scanBoundary(&m)) {
|
||||||
if (!strncmp(m, "XX", 2)) // not spec compliant!
|
if (!strncmp(m, "XX", 2)) // not spec compliant!
|
||||||
m += 2, sign = 0;
|
m += 2, sign = 0, dew = temp;
|
||||||
else {
|
else {
|
||||||
sign = 1;
|
sign = 1;
|
||||||
if (*m == 'M')
|
if (*m == 'M')
|
||||||
@@ -907,19 +971,22 @@ bool SGMetar::scanRunwayReport()
|
|||||||
|
|
||||||
if (!strncmp(m, "CLRD", 4)) {
|
if (!strncmp(m, "CLRD", 4)) {
|
||||||
m += 4; // runway cleared
|
m += 4; // runway cleared
|
||||||
r._deposit = "cleared";
|
r._deposit_string = "cleared";
|
||||||
} else {
|
} else {
|
||||||
if (scanNumber(&m, &i, 1)) {
|
if (scanNumber(&m, &i, 1)) {
|
||||||
r._deposit = runway_deposit[i];
|
r._deposit = i;
|
||||||
|
r._deposit_string = runway_deposit[i];
|
||||||
} else if (*m == '/')
|
} else if (*m == '/')
|
||||||
m++;
|
m++;
|
||||||
else
|
else
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (*m == '1' || *m == '2' || *m == '5' || *m == '9') { // extent of deposit
|
if (*m == '1' || *m == '2' || *m == '5' || *m == '9') { // extent of deposit
|
||||||
r._extent = *m - '0';
|
r._extent = *m - '0';
|
||||||
r._extent_string = runway_deposit_extent[*m - '0'];
|
r._extent_string = runway_deposit_extent[*m - '0'];
|
||||||
} else if (*m != '/')
|
} else if (*m != '/')
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
m++;
|
m++;
|
||||||
i = -1;
|
i = -1;
|
||||||
if (!strncmp(m, "//", 2))
|
if (!strncmp(m, "//", 2))
|
||||||
@@ -928,7 +995,7 @@ bool SGMetar::scanRunwayReport()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
if (i == 0)
|
if (i == 0)
|
||||||
r._depth = 0.5; // < 1 mm deep (let's say 0.5 :-)
|
r._depth = 0.0005; // < 1 mm deep (let's say 0.5 :-)
|
||||||
else if (i > 0 && i <= 90)
|
else if (i > 0 && i <= 90)
|
||||||
r._depth = i / 1000.0; // i mm deep
|
r._depth = i / 1000.0; // i mm deep
|
||||||
else if (i >= 92 && i <= 98)
|
else if (i >= 92 && i <= 98)
|
||||||
@@ -954,6 +1021,7 @@ bool SGMetar::scanRunwayReport()
|
|||||||
return false;
|
return false;
|
||||||
|
|
||||||
_runways[id]._deposit = r._deposit;
|
_runways[id]._deposit = r._deposit;
|
||||||
|
_runways[id]._deposit_string = r._deposit_string;
|
||||||
_runways[id]._extent = r._extent;
|
_runways[id]._extent = r._extent;
|
||||||
_runways[id]._extent_string = r._extent_string;
|
_runways[id]._extent_string = r._extent_string;
|
||||||
_runways[id]._depth = r._depth;
|
_runways[id]._depth = r._depth;
|
||||||
@@ -1033,13 +1101,13 @@ bool SGMetar::scanTrendForecast()
|
|||||||
|
|
||||||
// (BLU|WHT|GRN|YLO|AMB|RED)
|
// (BLU|WHT|GRN|YLO|AMB|RED)
|
||||||
static const struct Token colors[] = {
|
static const struct Token colors[] = {
|
||||||
"BLU", "Blue", // 2500 ft, 8.0 km
|
{ "BLU", "Blue" }, // 2500 ft, 8.0 km
|
||||||
"WHT", "White", // 1500 ft, 5.0 km
|
{ "WHT", "White" }, // 1500 ft, 5.0 km
|
||||||
"GRN", "Green", // 700 ft, 3.7 km
|
{ "GRN", "Green" }, // 700 ft, 3.7 km
|
||||||
"YLO", "Yellow", // 300 ft, 1.6 km
|
{ "YLO", "Yellow" }, // 300 ft, 1.6 km
|
||||||
"AMB", "Amber", // 200 ft, 0.8 km
|
{ "AMB", "Amber" }, // 200 ft, 0.8 km
|
||||||
"RED", "Red", // <200 ft, <0.8 km
|
{ "RED", "Red" }, // <200 ft, <0.8 km
|
||||||
0, 0
|
{ 0, 0 }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -1125,7 +1193,7 @@ const struct Token *SGMetar::scanToken(char **str, const struct Token *list)
|
|||||||
{
|
{
|
||||||
const struct Token *longest = 0;
|
const struct Token *longest = 0;
|
||||||
int maxlen = 0, len;
|
int maxlen = 0, len;
|
||||||
char *s;
|
const char *s;
|
||||||
for (int i = 0; (s = list[i].id); i++) {
|
for (int i = 0; (s = list[i].id); i++) {
|
||||||
len = strlen(s);
|
len = strlen(s);
|
||||||
if (!strncmp(s, *str, len) && len > maxlen) {
|
if (!strncmp(s, *str, len) && len > maxlen) {
|
||||||
@@ -1137,4 +1205,40 @@ const struct Token *SGMetar::scanToken(char **str, const struct Token *list)
|
|||||||
return longest;
|
return longest;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SGMetarCloud::set(double alt, Coverage cov)
|
||||||
|
{
|
||||||
|
_altitude = alt;
|
||||||
|
if (cov != -1)
|
||||||
|
_coverage = cov;
|
||||||
|
}
|
||||||
|
|
||||||
|
SGMetarCloud::Coverage SGMetarCloud::getCoverage( const std::string & coverage )
|
||||||
|
{
|
||||||
|
if( coverage == "clear" ) return COVERAGE_CLEAR;
|
||||||
|
if( coverage == "few" ) return COVERAGE_FEW;
|
||||||
|
if( coverage == "scattered" ) return COVERAGE_SCATTERED;
|
||||||
|
if( coverage == "broken" ) return COVERAGE_BROKEN;
|
||||||
|
if( coverage == "overcast" ) return COVERAGE_OVERCAST;
|
||||||
|
return COVERAGE_NIL;
|
||||||
|
}
|
||||||
|
|
||||||
|
const char * SGMetarCloud::COVERAGE_NIL_STRING = "nil";
|
||||||
|
const char * SGMetarCloud::COVERAGE_CLEAR_STRING = "clear";
|
||||||
|
const char * SGMetarCloud::COVERAGE_FEW_STRING = "few";
|
||||||
|
const char * SGMetarCloud::COVERAGE_SCATTERED_STRING = "scattered";
|
||||||
|
const char * SGMetarCloud::COVERAGE_BROKEN_STRING = "broken";
|
||||||
|
const char * SGMetarCloud::COVERAGE_OVERCAST_STRING = "overcast";
|
||||||
|
|
||||||
|
void SGMetarVisibility::set(double dist, int dir, int mod, int tend)
|
||||||
|
{
|
||||||
|
_distance = dist;
|
||||||
|
if (dir != -1)
|
||||||
|
_direction = dir;
|
||||||
|
if (mod != -1)
|
||||||
|
_modifier = mod;
|
||||||
|
if (tend != 1)
|
||||||
|
_tendency = tend;
|
||||||
|
}
|
||||||
|
|
||||||
#undef NaN
|
#undef NaN
|
||||||
|
|||||||
@@ -16,7 +16,7 @@
|
|||||||
//
|
//
|
||||||
// You should have received a copy of the GNU General Public License
|
// You should have received a copy of the GNU General Public License
|
||||||
// along with this program; if not, write to the Free Software
|
// along with this program; if not, write to the Free Software
|
||||||
// Foundation, 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
@@ -29,16 +29,16 @@
|
|||||||
|
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
|
|
||||||
SG_USING_STD(vector);
|
using std::vector;
|
||||||
SG_USING_STD(map);
|
using std::map;
|
||||||
SG_USING_STD(string);
|
using std::string;
|
||||||
|
|
||||||
const double SGMetarNaN = -1E20;
|
const double SGMetarNaN = -1E20;
|
||||||
#define NaN SGMetarNaN
|
#define NaN SGMetarNaN
|
||||||
|
|
||||||
struct Token {
|
struct Token {
|
||||||
char *id;
|
const char *id;
|
||||||
char *text;
|
const char *text;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
@@ -67,6 +67,8 @@ public:
|
|||||||
DECREASING
|
DECREASING
|
||||||
};
|
};
|
||||||
|
|
||||||
|
void set(double dist, int dir = -1, int mod = -1, int tend = -1);
|
||||||
|
|
||||||
inline double getVisibility_m() const { return _distance; }
|
inline double getVisibility_m() const { return _distance; }
|
||||||
inline double getVisibility_ft() const { return _distance == NaN ? NaN : _distance * SG_METER_TO_FEET; }
|
inline double getVisibility_ft() const { return _distance == NaN ? NaN : _distance * SG_METER_TO_FEET; }
|
||||||
inline double getVisibility_sm() const { return _distance == NaN ? NaN : _distance * SG_METER_TO_SM; }
|
inline double getVisibility_sm() const { return _distance == NaN ? NaN : _distance * SG_METER_TO_SM; }
|
||||||
@@ -87,7 +89,8 @@ class SGMetarRunway {
|
|||||||
friend class SGMetar;
|
friend class SGMetar;
|
||||||
public:
|
public:
|
||||||
SGMetarRunway() :
|
SGMetarRunway() :
|
||||||
_deposit(0),
|
_deposit(-1),
|
||||||
|
_deposit_string(0),
|
||||||
_extent(-1),
|
_extent(-1),
|
||||||
_extent_string(0),
|
_extent_string(0),
|
||||||
_depth(NaN),
|
_depth(NaN),
|
||||||
@@ -96,7 +99,8 @@ public:
|
|||||||
_comment(0),
|
_comment(0),
|
||||||
_wind_shear(false) {}
|
_wind_shear(false) {}
|
||||||
|
|
||||||
inline const char *getDeposit() const { return _deposit; }
|
inline int getDeposit() const { return _deposit; }
|
||||||
|
inline const char *getDepositString() const { return _deposit_string; }
|
||||||
inline double getExtent() const { return _extent; }
|
inline double getExtent() const { return _extent; }
|
||||||
inline const char *getExtentString() const { return _extent_string; }
|
inline const char *getExtentString() const { return _extent_string; }
|
||||||
inline double getDepth() const { return _depth; }
|
inline double getDepth() const { return _depth; }
|
||||||
@@ -104,13 +108,14 @@ public:
|
|||||||
inline const char *getFrictionString() const { return _friction_string; }
|
inline const char *getFrictionString() const { return _friction_string; }
|
||||||
inline const char *getComment() const { return _comment; }
|
inline const char *getComment() const { return _comment; }
|
||||||
inline const bool getWindShear() const { return _wind_shear; }
|
inline const bool getWindShear() const { return _wind_shear; }
|
||||||
inline SGMetarVisibility getMinVisibility() const { return _min_visibility; }
|
inline const SGMetarVisibility& getMinVisibility() const { return _min_visibility; }
|
||||||
inline SGMetarVisibility getMaxVisibility() const { return _max_visibility; }
|
inline const SGMetarVisibility& getMaxVisibility() const { return _max_visibility; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
SGMetarVisibility _min_visibility;
|
SGMetarVisibility _min_visibility;
|
||||||
SGMetarVisibility _max_visibility;
|
SGMetarVisibility _max_visibility;
|
||||||
const char *_deposit;
|
int _deposit;
|
||||||
|
const char *_deposit_string;
|
||||||
int _extent;
|
int _extent;
|
||||||
const char *_extent_string;
|
const char *_extent_string;
|
||||||
double _depth;
|
double _depth;
|
||||||
@@ -125,29 +130,45 @@ protected:
|
|||||||
class SGMetarCloud {
|
class SGMetarCloud {
|
||||||
friend class SGMetar;
|
friend class SGMetar;
|
||||||
public:
|
public:
|
||||||
SGMetarCloud() :
|
enum Coverage {
|
||||||
_coverage(-1),
|
COVERAGE_NIL = -1,
|
||||||
_altitude(NaN),
|
COVERAGE_CLEAR = 0,
|
||||||
_type(0),
|
COVERAGE_FEW = 1,
|
||||||
_type_long(0) {}
|
COVERAGE_SCATTERED = 2,
|
||||||
|
COVERAGE_BROKEN = 3,
|
||||||
|
COVERAGE_OVERCAST = 4
|
||||||
|
};
|
||||||
|
|
||||||
inline int getCoverage() const { return _coverage; }
|
static const char * COVERAGE_NIL_STRING;
|
||||||
inline double getAltitude_m() const { return _altitude; }
|
static const char * COVERAGE_CLEAR_STRING;
|
||||||
inline double getAltitude_ft() const { return _altitude == NaN ? NaN : _altitude * SG_METER_TO_FEET; }
|
static const char * COVERAGE_FEW_STRING;
|
||||||
inline char *getTypeString() const { return _type; }
|
static const char * COVERAGE_SCATTERED_STRING;
|
||||||
inline char *getTypeLongString() const { return _type_long; }
|
static const char * COVERAGE_BROKEN_STRING;
|
||||||
|
static const char * COVERAGE_OVERCAST_STRING;
|
||||||
|
|
||||||
|
SGMetarCloud() : _coverage(COVERAGE_NIL), _altitude(NaN), _type(0), _type_long(0) {}
|
||||||
|
|
||||||
|
void set(double alt, Coverage cov = COVERAGE_NIL );
|
||||||
|
|
||||||
|
inline Coverage getCoverage() const { return _coverage; }
|
||||||
|
static Coverage getCoverage( const std::string & coverage );
|
||||||
|
inline double getAltitude_m() const { return _altitude; }
|
||||||
|
inline double getAltitude_ft() const { return _altitude == NaN ? NaN : _altitude * SG_METER_TO_FEET; }
|
||||||
|
inline const char *getTypeString() const { return _type; }
|
||||||
|
inline const char *getTypeLongString() const { return _type_long; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
int _coverage; // quarters: 0 -> clear ... 4 -> overcast
|
Coverage _coverage; // quarters: 0 -> clear ... 4 -> overcast
|
||||||
double _altitude; // 1000 m
|
double _altitude; // 1000 m
|
||||||
char *_type; // CU
|
const char *_type; // CU
|
||||||
char *_type_long; // cumulus
|
const char *_type_long; // cumulus
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
class SGMetar {
|
class SGMetar {
|
||||||
public:
|
public:
|
||||||
SGMetar(const string& m, const string& proxy = "", const string& port = "", const string &auth = "");
|
SGMetar(const string& m, const string& proxy = "", const string& port = "",
|
||||||
|
const string &auth = "", const time_t time = 0);
|
||||||
~SGMetar();
|
~SGMetar();
|
||||||
|
|
||||||
enum ReportType {
|
enum ReportType {
|
||||||
@@ -157,8 +178,24 @@ public:
|
|||||||
RTD
|
RTD
|
||||||
};
|
};
|
||||||
|
|
||||||
|
enum Intensity {
|
||||||
|
NIL = 0,
|
||||||
|
LIGHT = 1,
|
||||||
|
MODERATE = 2,
|
||||||
|
HEAVY = 3
|
||||||
|
};
|
||||||
|
|
||||||
|
struct Weather {
|
||||||
|
Weather() { intensity = NIL; vincinity = false; }
|
||||||
|
Intensity intensity;
|
||||||
|
bool vincinity;
|
||||||
|
vector<string> descriptions;
|
||||||
|
vector<string> phenomena;
|
||||||
|
};
|
||||||
|
|
||||||
inline const char *getData() const { return _data; }
|
inline const char *getData() const { return _data; }
|
||||||
inline const char *getUnusedData() const { return _m; }
|
inline const char *getUnusedData() const { return _m; }
|
||||||
|
inline const bool getProxy() const { return _x_proxy; }
|
||||||
inline const char *getId() const { return _icao; }
|
inline const char *getId() const { return _icao; }
|
||||||
inline int getYear() const { return _year; }
|
inline int getYear() const { return _year; }
|
||||||
inline int getMonth() const { return _month; }
|
inline int getMonth() const { return _month; }
|
||||||
@@ -181,10 +218,10 @@ public:
|
|||||||
inline int getWindRangeFrom() const { return _wind_range_from; }
|
inline int getWindRangeFrom() const { return _wind_range_from; }
|
||||||
inline int getWindRangeTo() const { return _wind_range_to; }
|
inline int getWindRangeTo() const { return _wind_range_to; }
|
||||||
|
|
||||||
inline SGMetarVisibility& getMinVisibility() { return _min_visibility; }
|
inline const SGMetarVisibility& getMinVisibility() const { return _min_visibility; }
|
||||||
inline SGMetarVisibility& getMaxVisibility() { return _max_visibility; }
|
inline const SGMetarVisibility& getMaxVisibility() const { return _max_visibility; }
|
||||||
inline SGMetarVisibility& getVertVisibility() { return _vert_visibility; }
|
inline const SGMetarVisibility& getVertVisibility() const { return _vert_visibility; }
|
||||||
inline SGMetarVisibility *getDirVisibility() { return _dir_visibility; }
|
inline const SGMetarVisibility *getDirVisibility() const { return _dir_visibility; }
|
||||||
|
|
||||||
inline double getTemperature_C() const { return _temp; }
|
inline double getTemperature_C() const { return _temp; }
|
||||||
inline double getTemperature_F() const { return _temp == NaN ? NaN : 1.8 * _temp + 32; }
|
inline double getTemperature_F() const { return _temp == NaN ? NaN : 1.8 * _temp + 32; }
|
||||||
@@ -193,15 +230,22 @@ public:
|
|||||||
inline double getPressure_hPa() const { return _pressure == NaN ? NaN : _pressure / 100; }
|
inline double getPressure_hPa() const { return _pressure == NaN ? NaN : _pressure / 100; }
|
||||||
inline double getPressure_inHg() const { return _pressure == NaN ? NaN : _pressure * SG_PA_TO_INHG; }
|
inline double getPressure_inHg() const { return _pressure == NaN ? NaN : _pressure * SG_PA_TO_INHG; }
|
||||||
|
|
||||||
|
inline int getRain() const { return _rain; }
|
||||||
|
inline int getHail() const { return _hail; }
|
||||||
|
inline int getSnow() const { return _snow; }
|
||||||
|
inline bool getCAVOK() const { return _cavok; }
|
||||||
|
|
||||||
double getRelHumidity() const;
|
double getRelHumidity() const;
|
||||||
|
|
||||||
inline vector<SGMetarCloud>& getClouds() { return _clouds; }
|
inline const vector<SGMetarCloud>& getClouds() const { return _clouds; }
|
||||||
inline map<string, SGMetarRunway>& getRunways() { return _runways; }
|
inline const map<string, SGMetarRunway>& getRunways() const { return _runways; }
|
||||||
inline vector<string>& getWeather() { return _weather; }
|
inline const vector<string>& getWeather() const { return _weather; }
|
||||||
|
inline const vector<struct Weather> getWeather2() const { return _weather2; }
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
string _url;
|
string _url;
|
||||||
int _grpcount;
|
int _grpcount;
|
||||||
|
bool _x_proxy;
|
||||||
char *_data;
|
char *_data;
|
||||||
char *_m;
|
char *_m;
|
||||||
char _icao[5];
|
char _icao[5];
|
||||||
@@ -219,6 +263,11 @@ protected:
|
|||||||
double _temp;
|
double _temp;
|
||||||
double _dewp;
|
double _dewp;
|
||||||
double _pressure;
|
double _pressure;
|
||||||
|
int _rain;
|
||||||
|
int _hail;
|
||||||
|
int _snow;
|
||||||
|
bool _cavok;
|
||||||
|
vector<struct Weather> _weather2;
|
||||||
|
|
||||||
SGMetarVisibility _min_visibility;
|
SGMetarVisibility _min_visibility;
|
||||||
SGMetarVisibility _max_visibility;
|
SGMetarVisibility _max_visibility;
|
||||||
@@ -230,6 +279,7 @@ protected:
|
|||||||
|
|
||||||
bool scanPreambleDate();
|
bool scanPreambleDate();
|
||||||
bool scanPreambleTime();
|
bool scanPreambleTime();
|
||||||
|
void useCurrentDate();
|
||||||
|
|
||||||
bool scanType();
|
bool scanType();
|
||||||
bool scanId();
|
bool scanId();
|
||||||
@@ -253,7 +303,8 @@ protected:
|
|||||||
int scanNumber(char **str, int *num, int min, int max = 0);
|
int scanNumber(char **str, int *num, int min, int max = 0);
|
||||||
bool scanBoundary(char **str);
|
bool scanBoundary(char **str);
|
||||||
const struct Token *scanToken(char **str, const struct Token *list);
|
const struct Token *scanToken(char **str, const struct Token *list);
|
||||||
char *loadData(const char *id, const string& proxy, const string& port, const string &auth);
|
char *loadData(const char *id, const string& proxy, const string& port,
|
||||||
|
const string &auth, time_t time);
|
||||||
void normalizeData();
|
void normalizeData();
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -0,0 +1,203 @@
|
|||||||
|
/**
|
||||||
|
* @file precipitation.cxx
|
||||||
|
* @author Nicolas VIVIEN
|
||||||
|
* @date 2008-02-10
|
||||||
|
*
|
||||||
|
* @note Copyright (C) 2008 Nicolas VIVIEN
|
||||||
|
*
|
||||||
|
* @brief Precipitation effects to draw rain and snow.
|
||||||
|
*
|
||||||
|
* @par Licences
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "precipitation.hxx"
|
||||||
|
//#include "visual_enviro.hxx"
|
||||||
|
|
||||||
|
#include <simgear/constants.h>
|
||||||
|
#include <osg/ClipNode>
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief SGPrecipitation constructor
|
||||||
|
*
|
||||||
|
* Build a new OSG object from osgParticle.
|
||||||
|
*/
|
||||||
|
SGPrecipitation::SGPrecipitation() :
|
||||||
|
_freeze(false), _enabled(true), _snow_intensity(0.0), _rain_intensity(0.0), _clip_distance(5.0)
|
||||||
|
{
|
||||||
|
_precipitationEffect = new osgParticle::PrecipitationEffect;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGPrecipitation::setEnabled( bool value )
|
||||||
|
{
|
||||||
|
_enabled = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SGPrecipitation::getEnabled() const
|
||||||
|
{
|
||||||
|
return _enabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Build and add the object "precipitationEffect"
|
||||||
|
*
|
||||||
|
* This function permits you to create an object precipitationEffect and initialize it.
|
||||||
|
* I define by default the color of water (for raining)
|
||||||
|
*/
|
||||||
|
osg::Group* SGPrecipitation::build(void)
|
||||||
|
{
|
||||||
|
osg::Group* group = new osg::Group;
|
||||||
|
|
||||||
|
_precipitationEffect->snow(0);
|
||||||
|
_precipitationEffect->rain(0);
|
||||||
|
|
||||||
|
if (_clip_distance!=0.0)
|
||||||
|
{
|
||||||
|
osg::ref_ptr<osg::ClipNode> clipNode = new osg::ClipNode;
|
||||||
|
clipNode->addClipPlane( new osg::ClipPlane( 0 ) );
|
||||||
|
clipNode->getClipPlane(0)->setClipPlane( 0.0, 0.0, -1.0, -_clip_distance );
|
||||||
|
clipNode->setReferenceFrame(osg::ClipNode::ABSOLUTE_RF);
|
||||||
|
clipNode->addChild(_precipitationEffect.get());
|
||||||
|
|
||||||
|
group->addChild(clipNode.get());
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
group->addChild(_precipitationEffect.get());
|
||||||
|
}
|
||||||
|
|
||||||
|
return group;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define the snow intensity
|
||||||
|
*
|
||||||
|
* This function permits you to define and change the snow intensity
|
||||||
|
* The param 'intensity' is normed (0 to 1).
|
||||||
|
*/
|
||||||
|
void SGPrecipitation::setSnowIntensity(float intensity)
|
||||||
|
{
|
||||||
|
if (this->_snow_intensity < intensity-0.001)
|
||||||
|
this->_snow_intensity += 0.001;
|
||||||
|
else if (this->_snow_intensity > intensity+0.001)
|
||||||
|
this->_snow_intensity -= 0.001;
|
||||||
|
else
|
||||||
|
this->_snow_intensity = intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define the rain intensity
|
||||||
|
*
|
||||||
|
* This function permits you to define and change the rain intensity
|
||||||
|
* The param 'intensity' is normed (0 to 1).
|
||||||
|
*/
|
||||||
|
void SGPrecipitation::setRainIntensity(float intensity)
|
||||||
|
{
|
||||||
|
if (this->_rain_intensity < intensity-0.001)
|
||||||
|
this->_rain_intensity += 0.001;
|
||||||
|
else if (this->_rain_intensity > intensity+0.001)
|
||||||
|
this->_rain_intensity -= 0.001;
|
||||||
|
else
|
||||||
|
this->_rain_intensity = intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Freeze the rain to snow
|
||||||
|
*
|
||||||
|
* @param freeze Boolean
|
||||||
|
*
|
||||||
|
* This function permits you to turn off the rain to snow.
|
||||||
|
*/
|
||||||
|
void SGPrecipitation::setFreezing(bool freeze)
|
||||||
|
{
|
||||||
|
this->_freeze = freeze;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Define the wind direction and speed
|
||||||
|
*
|
||||||
|
* This function permits you to define and change the wind direction
|
||||||
|
*
|
||||||
|
* After apply the MatrixTransform to the osg::Precipitation object,
|
||||||
|
* x points full south... From wind heading and speed, we can calculate
|
||||||
|
* the wind vector.
|
||||||
|
*/
|
||||||
|
void SGPrecipitation::setWindProperty(double heading, double speed)
|
||||||
|
{
|
||||||
|
double x, y, z;
|
||||||
|
|
||||||
|
heading = (heading + 180) * SGD_DEGREES_TO_RADIANS;
|
||||||
|
speed = speed * SG_FEET_TO_METER;
|
||||||
|
|
||||||
|
x = -cos(heading) * speed;
|
||||||
|
y = sin(heading) * speed;
|
||||||
|
z = 0;
|
||||||
|
|
||||||
|
this->_wind_vec = osg::Vec3(x, y, z);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Update the precipitation effects
|
||||||
|
*
|
||||||
|
* This function permits you to update the precipitation effects.
|
||||||
|
* Be careful, if snow and rain intensity are greater than '0', snow effect
|
||||||
|
* will be first.
|
||||||
|
*
|
||||||
|
* The settings come from the osgParticule/PrecipitationEffect.cpp exemple.
|
||||||
|
*/
|
||||||
|
bool SGPrecipitation::update(void)
|
||||||
|
{
|
||||||
|
if (this->_freeze) {
|
||||||
|
if (this->_rain_intensity > 0)
|
||||||
|
this->_snow_intensity = this->_rain_intensity;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_enabled && this->_snow_intensity > 0) {
|
||||||
|
_precipitationEffect->setWind(_wind_vec);
|
||||||
|
_precipitationEffect->setParticleSpeed( -0.75f - 0.25f*_snow_intensity);
|
||||||
|
|
||||||
|
_precipitationEffect->setParticleSize(0.02f + 0.03f*_snow_intensity);
|
||||||
|
_precipitationEffect->setMaximumParticleDensity(_snow_intensity * 7.2f);
|
||||||
|
_precipitationEffect->setCellSize(osg::Vec3(5.0f / (0.25f+_snow_intensity), 5.0f / (0.25f+_snow_intensity), 5.0f));
|
||||||
|
|
||||||
|
_precipitationEffect->setNearTransition(25.f);
|
||||||
|
_precipitationEffect->setFarTransition(100.0f - 60.0f*sqrtf(_snow_intensity));
|
||||||
|
|
||||||
|
_precipitationEffect->setParticleColor(osg::Vec4(0.85, 0.85, 0.85, 1.0) - osg::Vec4(0.1, 0.1, 0.1, 1.0) * _snow_intensity);
|
||||||
|
} else if (_enabled && this->_rain_intensity > 0) {
|
||||||
|
_precipitationEffect->setWind(_wind_vec);
|
||||||
|
_precipitationEffect->setParticleSpeed( -2.0f + -5.0f*_rain_intensity);
|
||||||
|
|
||||||
|
_precipitationEffect->setParticleSize(0.01 + 0.02*_rain_intensity);
|
||||||
|
_precipitationEffect->setMaximumParticleDensity(_rain_intensity * 7.5f);
|
||||||
|
_precipitationEffect->setCellSize(osg::Vec3(5.0f / (0.25f+_rain_intensity), 5.0f / (0.25f+_rain_intensity), 5.0f));
|
||||||
|
|
||||||
|
_precipitationEffect->setNearTransition(25.f);
|
||||||
|
_precipitationEffect->setFarTransition(100.0f - 60.0f*sqrtf(_rain_intensity));
|
||||||
|
|
||||||
|
_precipitationEffect->setParticleColor( osg::Vec4(0x7A, 0xCE, 0xFF, 0x80));
|
||||||
|
} else {
|
||||||
|
_precipitationEffect->snow(0);
|
||||||
|
_precipitationEffect->rain(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
@@ -0,0 +1,65 @@
|
|||||||
|
/**
|
||||||
|
* @file precipitation.hxx
|
||||||
|
* @author Nicolas VIVIEN
|
||||||
|
* @date 2008-02-10
|
||||||
|
*
|
||||||
|
* @note Copyright (C) 2008 Nicolas VIVIEN
|
||||||
|
*
|
||||||
|
* @brief Precipitation effects to draw rain and snow.
|
||||||
|
*
|
||||||
|
* @par Licences
|
||||||
|
* This program is free software; you can redistribute it and/or
|
||||||
|
* modify it under the terms of the GNU General Public License as
|
||||||
|
* published by the Free Software Foundation; either version 2 of the
|
||||||
|
* License, or (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful, but
|
||||||
|
* WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
* General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program; if not, write to the Free Software
|
||||||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _PRECIPITATION_HXX
|
||||||
|
#define _PRECIPITATION_HXX
|
||||||
|
|
||||||
|
#include <osg/Group>
|
||||||
|
#include <osg/Referenced>
|
||||||
|
#include <osgParticle/PrecipitationEffect>
|
||||||
|
|
||||||
|
|
||||||
|
class SGPrecipitation : public osg::Referenced
|
||||||
|
{
|
||||||
|
private:
|
||||||
|
bool _freeze;
|
||||||
|
bool _enabled;
|
||||||
|
|
||||||
|
float _snow_intensity;
|
||||||
|
float _rain_intensity;
|
||||||
|
float _clip_distance;
|
||||||
|
|
||||||
|
int _wind_dir;
|
||||||
|
osg::Vec3 _wind_vec;
|
||||||
|
|
||||||
|
osg::ref_ptr<osgParticle::PrecipitationEffect> _precipitationEffect;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SGPrecipitation();
|
||||||
|
virtual ~SGPrecipitation() {}
|
||||||
|
osg::Group* build(void);
|
||||||
|
bool update(void);
|
||||||
|
|
||||||
|
void setWindProperty(double, double);
|
||||||
|
void setFreezing(bool);
|
||||||
|
void setRainIntensity(float);
|
||||||
|
void setSnowIntensity(float);
|
||||||
|
|
||||||
|
void setEnabled( bool );
|
||||||
|
bool getEnabled() const;
|
||||||
|
};
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,494 @@
|
|||||||
|
// Visual environment helper class
|
||||||
|
//
|
||||||
|
// Written by Harald JOHNSEN, started April 2005.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <simgear/constants.h>
|
||||||
|
#include <simgear/structure/SGReferenced.hxx>
|
||||||
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
#include <simgear/math/sg_random.h>
|
||||||
|
#include <simgear/math/sg_geodesy.hxx>
|
||||||
|
#include <simgear/sound/sample_group.hxx>
|
||||||
|
#include <simgear/scene/sky/cloudfield.hxx>
|
||||||
|
#include <simgear/scene/sky/newcloud.hxx>
|
||||||
|
#include <simgear/props/props.hxx>
|
||||||
|
#include "visual_enviro.hxx"
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
using std::vector;
|
||||||
|
|
||||||
|
|
||||||
|
typedef struct {
|
||||||
|
SGVec3d pt;
|
||||||
|
int depth;
|
||||||
|
int prev;
|
||||||
|
} lt_tree_seg;
|
||||||
|
|
||||||
|
#define MAX_RAIN_SLICE 200
|
||||||
|
static float rainpos[MAX_RAIN_SLICE];
|
||||||
|
#define MAX_LT_TREE_SEG 400
|
||||||
|
|
||||||
|
#define DFL_MIN_LIGHT 0.35
|
||||||
|
SGVec3f SGEnviro::min_light(DFL_MIN_LIGHT, DFL_MIN_LIGHT, DFL_MIN_LIGHT);
|
||||||
|
#define DFL_STREAK_BRIGHT_NEARMOST_LAYER 0.9
|
||||||
|
float SGEnviro::streak_bright_nearmost_layer = DFL_STREAK_BRIGHT_NEARMOST_LAYER;
|
||||||
|
#define DFL_STREAK_BRIGHT_FARMOST_LAYER 0.5
|
||||||
|
float SGEnviro::streak_bright_farmost_layer = DFL_STREAK_BRIGHT_FARMOST_LAYER;
|
||||||
|
#define DFL_STREAK_PERIOD_MAX 2.5
|
||||||
|
float SGEnviro::streak_period_max = DFL_STREAK_PERIOD_MAX;
|
||||||
|
#define DFL_STREAK_PERIOD_CHANGE_PER_KT 0.005
|
||||||
|
float SGEnviro::streak_period_change_per_kt = DFL_STREAK_PERIOD_CHANGE_PER_KT;
|
||||||
|
#define DFL_STREAK_PERIOD_MIN 1.0
|
||||||
|
float SGEnviro::streak_period_min = DFL_STREAK_PERIOD_MIN;
|
||||||
|
#define DFL_STREAK_LENGTH_MIN 0.03
|
||||||
|
float SGEnviro::streak_length_min = DFL_STREAK_LENGTH_MIN;
|
||||||
|
#define DFL_STREAK_LENGTH_CHANGE_PER_KT 0.0005
|
||||||
|
float SGEnviro::streak_length_change_per_kt = DFL_STREAK_LENGTH_CHANGE_PER_KT;
|
||||||
|
#define DFL_STREAK_LENGTH_MAX 0.1
|
||||||
|
float SGEnviro::streak_length_max = DFL_STREAK_LENGTH_MAX;
|
||||||
|
#define DFL_STREAK_COUNT_MIN 40
|
||||||
|
int SGEnviro::streak_count_min = DFL_STREAK_COUNT_MIN;
|
||||||
|
#define DFL_STREAK_COUNT_MAX 190
|
||||||
|
#if (DFL_STREAK_COUNT_MAX > MAX_RAIN_SLICE)
|
||||||
|
#error "Bad default!"
|
||||||
|
#endif
|
||||||
|
int SGEnviro::streak_count_max = DFL_STREAK_COUNT_MAX;
|
||||||
|
#define DFL_CONE_BASE_RADIUS 15.0
|
||||||
|
float SGEnviro::cone_base_radius = DFL_CONE_BASE_RADIUS;
|
||||||
|
#define DFL_CONE_HEIGHT 30.0
|
||||||
|
float SGEnviro::cone_height = DFL_CONE_HEIGHT;
|
||||||
|
|
||||||
|
|
||||||
|
void SGEnviro::config(const SGPropertyNode* n)
|
||||||
|
{
|
||||||
|
if (!n)
|
||||||
|
return;
|
||||||
|
|
||||||
|
const float ml = n->getFloatValue("min-light", DFL_MIN_LIGHT);
|
||||||
|
min_light = SGVec3f(ml, ml, ml);
|
||||||
|
|
||||||
|
streak_bright_nearmost_layer = n->getFloatValue(
|
||||||
|
"streak-brightness-nearmost-layer",
|
||||||
|
DFL_STREAK_BRIGHT_NEARMOST_LAYER);
|
||||||
|
streak_bright_farmost_layer = n->getFloatValue(
|
||||||
|
"streak-brightness-farmost-layer",
|
||||||
|
DFL_STREAK_BRIGHT_FARMOST_LAYER);
|
||||||
|
|
||||||
|
streak_period_max = n->getFloatValue(
|
||||||
|
"streak-period-max",
|
||||||
|
DFL_STREAK_PERIOD_MAX);
|
||||||
|
streak_period_min = n->getFloatValue(
|
||||||
|
"streak-period-min",
|
||||||
|
DFL_STREAK_PERIOD_MIN);
|
||||||
|
streak_period_change_per_kt = n->getFloatValue(
|
||||||
|
"streak-period-change-per-kt",
|
||||||
|
DFL_STREAK_PERIOD_CHANGE_PER_KT);
|
||||||
|
|
||||||
|
streak_length_max = n->getFloatValue(
|
||||||
|
"streak-length-max",
|
||||||
|
DFL_STREAK_LENGTH_MAX);
|
||||||
|
streak_length_min = n->getFloatValue(
|
||||||
|
"streak-length-min",
|
||||||
|
DFL_STREAK_LENGTH_MIN);
|
||||||
|
streak_length_change_per_kt = n->getFloatValue(
|
||||||
|
"streak-length-change-per-kt",
|
||||||
|
DFL_STREAK_LENGTH_CHANGE_PER_KT);
|
||||||
|
|
||||||
|
streak_count_min = n->getIntValue(
|
||||||
|
"streak-count-min", DFL_STREAK_COUNT_MIN);
|
||||||
|
streak_count_max = n->getIntValue(
|
||||||
|
"streak-count-max", DFL_STREAK_COUNT_MAX);
|
||||||
|
if (streak_count_max > MAX_RAIN_SLICE)
|
||||||
|
streak_count_max = MAX_RAIN_SLICE;
|
||||||
|
|
||||||
|
cone_base_radius = n->getFloatValue(
|
||||||
|
"cone-base-radius", DFL_CONE_BASE_RADIUS);
|
||||||
|
cone_height = n->getFloatValue("cone_height", DFL_CONE_HEIGHT);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A class to render lightnings.
|
||||||
|
*/
|
||||||
|
class SGLightning {
|
||||||
|
public:
|
||||||
|
/**
|
||||||
|
* Build a new lightning.
|
||||||
|
* The lightning has a limited life time. It will also play a thunder sounder once.
|
||||||
|
* @param lon lon longitude in degree
|
||||||
|
* @param lat lat latitude in degree
|
||||||
|
* @param alt asl of top of lightning
|
||||||
|
*/
|
||||||
|
SGLightning(double lon, double lat, double alt);
|
||||||
|
~SGLightning();
|
||||||
|
void lt_Render(void);
|
||||||
|
void lt_build(void);
|
||||||
|
void lt_build_tree_branch(int tree_nr, SGVec3d &start, float energy, int nbseg, float segsize);
|
||||||
|
|
||||||
|
// contains all the segments of the lightning
|
||||||
|
lt_tree_seg lt_tree[MAX_LT_TREE_SEG];
|
||||||
|
// segment count
|
||||||
|
int nb_tree;
|
||||||
|
// position of lightning
|
||||||
|
double lon, lat, alt;
|
||||||
|
int sequence_count;
|
||||||
|
// time to live
|
||||||
|
double age;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef vector<SGLightning *> list_of_lightning;
|
||||||
|
static list_of_lightning lightnings;
|
||||||
|
|
||||||
|
SGEnviro sgEnviro;
|
||||||
|
|
||||||
|
SGEnviro::SGEnviro() :
|
||||||
|
view_in_cloud(false),
|
||||||
|
precipitation_enable_state(true),
|
||||||
|
precipitation_density(100.0),
|
||||||
|
precipitation_max_alt(0.0),
|
||||||
|
turbulence_enable_state(false),
|
||||||
|
last_cloud_turbulence(0.0),
|
||||||
|
cloud_turbulence(0.0),
|
||||||
|
lightning_enable_state(false),
|
||||||
|
elapsed_time(0.0),
|
||||||
|
dt(0.0),
|
||||||
|
sampleGroup(NULL),
|
||||||
|
snd_active(false),
|
||||||
|
snd_dist(0.0),
|
||||||
|
min_time_before_lt(0.0),
|
||||||
|
fov_width(55.0),
|
||||||
|
fov_height(55.0)
|
||||||
|
|
||||||
|
{
|
||||||
|
for(int i = 0; i < MAX_RAIN_SLICE ; i++)
|
||||||
|
rainpos[i] = sg_random();
|
||||||
|
radarEcho.reserve(100);
|
||||||
|
}
|
||||||
|
|
||||||
|
SGEnviro::~SGEnviro(void) {
|
||||||
|
// if (sampleGroup) delete sampleGroup;
|
||||||
|
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
list_of_lightning::iterator iLightning;
|
||||||
|
for( iLightning = lightnings.begin() ; iLightning != lightnings.end() ; ++iLightning ) {
|
||||||
|
delete (*iLightning);
|
||||||
|
}
|
||||||
|
lightnings.clear();
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::startOfFrame( SGVec3f p, SGVec3f up, double lon, double lat, double alt, double delta_time) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
view_in_cloud = false;
|
||||||
|
// ask the impostor cache to do some cleanup
|
||||||
|
last_cloud_turbulence = cloud_turbulence;
|
||||||
|
cloud_turbulence = 0.0;
|
||||||
|
elapsed_time += delta_time;
|
||||||
|
min_time_before_lt -= delta_time;
|
||||||
|
dt = delta_time;
|
||||||
|
#if 0
|
||||||
|
sgMat4 T1, LON, LAT;
|
||||||
|
sgVec3 axis;
|
||||||
|
|
||||||
|
sgMakeTransMat4( T1, p );
|
||||||
|
|
||||||
|
sgSetVec3( axis, 0.0, 0.0, 1.0 );
|
||||||
|
sgMakeRotMat4( LON, lon, axis );
|
||||||
|
|
||||||
|
sgSetVec3( axis, 0.0, 1.0, 0.0 );
|
||||||
|
sgMakeRotMat4( LAT, 90.0 - lat, axis );
|
||||||
|
|
||||||
|
sgMat4 TRANSFORM;
|
||||||
|
|
||||||
|
sgCopyMat4( TRANSFORM, T1 );
|
||||||
|
sgPreMultMat4( TRANSFORM, LON );
|
||||||
|
sgPreMultMat4( TRANSFORM, LAT );
|
||||||
|
|
||||||
|
sgCoord pos;
|
||||||
|
sgSetCoord( &pos, TRANSFORM );
|
||||||
|
|
||||||
|
sgMakeCoordMat4( transform, &pos );
|
||||||
|
#endif
|
||||||
|
last_lon = lon;
|
||||||
|
last_lat = lat;
|
||||||
|
last_alt = alt;
|
||||||
|
|
||||||
|
radarEcho.clear();
|
||||||
|
precipitation_max_alt = 400.0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::endOfFrame(void) {
|
||||||
|
}
|
||||||
|
|
||||||
|
double SGEnviro::get_cloud_turbulence(void) const {
|
||||||
|
return last_cloud_turbulence;
|
||||||
|
}
|
||||||
|
|
||||||
|
// this can be queried to add some turbulence for example
|
||||||
|
bool SGEnviro::is_view_in_cloud(void) const {
|
||||||
|
return view_in_cloud;
|
||||||
|
}
|
||||||
|
void SGEnviro::set_view_in_cloud(bool incloud) {
|
||||||
|
view_in_cloud = incloud;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool SGEnviro::get_turbulence_enable_state(void) const {
|
||||||
|
return turbulence_enable_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::set_turbulence_enable_state(bool enable) {
|
||||||
|
turbulence_enable_state = enable;
|
||||||
|
}
|
||||||
|
// rain/snow
|
||||||
|
float SGEnviro::get_precipitation_density(void) const {
|
||||||
|
return precipitation_density;
|
||||||
|
}
|
||||||
|
bool SGEnviro::get_precipitation_enable_state(void) const {
|
||||||
|
return precipitation_enable_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::set_precipitation_density(float density) {
|
||||||
|
precipitation_density = density;
|
||||||
|
}
|
||||||
|
void SGEnviro::set_precipitation_enable_state(bool enable) {
|
||||||
|
precipitation_enable_state = enable;
|
||||||
|
}
|
||||||
|
|
||||||
|
// others
|
||||||
|
bool SGEnviro::get_lightning_enable_state(void) const {
|
||||||
|
return lightning_enable_state;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::set_lightning_enable_state(bool enable) {
|
||||||
|
lightning_enable_state = enable;
|
||||||
|
if( ! enable ) {
|
||||||
|
// TODO:cleanup
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::setLight(SGVec4f adj_fog_color) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
fog_color = adj_fog_color;
|
||||||
|
if( false ) {
|
||||||
|
// ssgGetLight( 0 ) -> setColour( GL_DIFFUSE, l->scene_diffuse() );
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#if 0
|
||||||
|
void SGEnviro::callback_cloud(float heading, float alt, float radius, int family, float dist, int cloudId) {
|
||||||
|
// send data to wx radar
|
||||||
|
// compute turbulence
|
||||||
|
// draw precipitation
|
||||||
|
// draw lightning
|
||||||
|
// compute illumination
|
||||||
|
|
||||||
|
// http://www.pilotfriend.com/flight_training/weather/THUNDERSTORM%20HAZARDS1.htm
|
||||||
|
double turbulence = 0.0;
|
||||||
|
if( dist < radius * radius * 2.25f ) {
|
||||||
|
switch(family) {
|
||||||
|
case SGNewCloud::CLFamilly_st:
|
||||||
|
turbulence = 0.2;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_ci:
|
||||||
|
case SGNewCloud::CLFamilly_cs:
|
||||||
|
case SGNewCloud::CLFamilly_cc:
|
||||||
|
case SGNewCloud::CLFamilly_ac:
|
||||||
|
case SGNewCloud::CLFamilly_as:
|
||||||
|
turbulence = 0.1;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_sc:
|
||||||
|
turbulence = 0.3;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_ns:
|
||||||
|
turbulence = 0.4;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_cu:
|
||||||
|
turbulence = 0.5;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_cb:
|
||||||
|
turbulence = 0.6;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
// full turbulence inside cloud, half in the vicinity
|
||||||
|
if( dist > radius * radius )
|
||||||
|
turbulence *= 0.5;
|
||||||
|
if( turbulence > cloud_turbulence )
|
||||||
|
cloud_turbulence = turbulence;
|
||||||
|
// we can do 'local' precipitations too
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to LWC for radar (experimental)
|
||||||
|
// http://www-das.uwyo.edu/~geerts/cwx/notes/chap08/moist_cloud.html
|
||||||
|
double LWC = 0.0;
|
||||||
|
switch(family) {
|
||||||
|
case SGNewCloud::CLFamilly_st:
|
||||||
|
LWC = 0.29;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_cu:
|
||||||
|
LWC = 0.27;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_cb:
|
||||||
|
LWC = 2.0;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_sc:
|
||||||
|
LWC = 0.44;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_ci:
|
||||||
|
LWC = 0.03;
|
||||||
|
break;
|
||||||
|
// no data
|
||||||
|
case SGNewCloud::CLFamilly_cs:
|
||||||
|
case SGNewCloud::CLFamilly_cc:
|
||||||
|
case SGNewCloud::CLFamilly_ac:
|
||||||
|
case SGNewCloud::CLFamilly_as:
|
||||||
|
LWC = 0.03;
|
||||||
|
break;
|
||||||
|
case SGNewCloud::CLFamilly_ns:
|
||||||
|
LWC = 0.29*2.0;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
// add to the list for the wxRadar instrument
|
||||||
|
if( LWC > 0.0 )
|
||||||
|
radarEcho.push_back( SGWxRadarEcho ( heading, alt, radius, dist, LWC, false, cloudId ) );
|
||||||
|
|
||||||
|
// NB:data valid only from cockpit view
|
||||||
|
|
||||||
|
// spawn a new lightning
|
||||||
|
if(lightning_enable_state && min_time_before_lt <= 0.0 && (family == SGNewCloud::CLFamilly_cb) &&
|
||||||
|
dist < 15000.0 * 15000.0 && sg_random() > 0.9f) {
|
||||||
|
double lat, lon;
|
||||||
|
SGVec3d orig, dest;
|
||||||
|
orig.setlat(last_lat * SG_DEGREES_TO_RADIANS );
|
||||||
|
orig.setlon(last_lon * SG_DEGREES_TO_RADIANS );
|
||||||
|
orig.setelev(0.0);
|
||||||
|
dist = sgSqrt(dist);
|
||||||
|
dest = calc_gc_lon_lat(orig, heading, dist);
|
||||||
|
lon = dest.lon() * SG_RADIANS_TO_DEGREES;
|
||||||
|
lat = dest.lat() * SG_RADIANS_TO_DEGREES;
|
||||||
|
addLightning( lon, lat, alt );
|
||||||
|
|
||||||
|
// reset timer
|
||||||
|
min_time_before_lt = 5.0 + sg_random() * 30;
|
||||||
|
// DEBUG only
|
||||||
|
// min_time_before_lt = 5.0;
|
||||||
|
}
|
||||||
|
if( (alt - radius * 0.1) > precipitation_max_alt )
|
||||||
|
switch(family) {
|
||||||
|
case SGNewCloud::CLFamilly_st:
|
||||||
|
case SGNewCloud::CLFamilly_cu:
|
||||||
|
case SGNewCloud::CLFamilly_cb:
|
||||||
|
case SGNewCloud::CLFamilly_ns:
|
||||||
|
case SGNewCloud::CLFamilly_sc:
|
||||||
|
precipitation_max_alt = alt - radius * 0.1;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
|
|
||||||
|
list_of_SGWxRadarEcho *SGEnviro::get_radar_echo(void) {
|
||||||
|
return &radarEcho;
|
||||||
|
}
|
||||||
|
|
||||||
|
// precipitation rendering code
|
||||||
|
void SGEnviro::DrawCone2(float baseRadius, float height, int slices, bool down, double rain_norm, double speed) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::drawRain(double pitch, double roll, double heading, double hspeed, double rain_norm) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::set_sampleGroup(SGSampleGroup *sgr) {
|
||||||
|
sampleGroup = sgr;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::drawPrecipitation(double rain_norm, double snow_norm, double hail_norm, double pitch, double roll, double heading, double hspeed) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
if( precipitation_enable_state && rain_norm > 0.0)
|
||||||
|
if( precipitation_max_alt >= last_alt )
|
||||||
|
drawRain(pitch, roll, heading, hspeed, rain_norm);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
SGLightning::SGLightning(double _lon, double _lat, double _alt) :
|
||||||
|
nb_tree(0),
|
||||||
|
lon(_lon),
|
||||||
|
lat(_lat),
|
||||||
|
alt(_alt),
|
||||||
|
age(1.0 + sg_random() * 4.0)
|
||||||
|
{
|
||||||
|
// sequence_count = 1 + sg_random() * 5.0;
|
||||||
|
lt_build();
|
||||||
|
}
|
||||||
|
|
||||||
|
SGLightning::~SGLightning() {
|
||||||
|
}
|
||||||
|
|
||||||
|
// lightning rendering code
|
||||||
|
void SGLightning::lt_build_tree_branch(int tree_nr, SGVec3d &start, float energy, int nbseg, float segsize) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGLightning::lt_build(void) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SGLightning::lt_Render(void) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::addLightning(double lon, double lat, double alt) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
if( lightnings.size() > 10)
|
||||||
|
return;
|
||||||
|
SGLightning *lt= new SGLightning(lon, lat, alt);
|
||||||
|
lightnings.push_back(lt);
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::drawLightning(void) {
|
||||||
|
// OSGFIXME
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
void SGEnviro::setFOV( float w, float h ) {
|
||||||
|
fov_width = w;
|
||||||
|
fov_height = h;
|
||||||
|
}
|
||||||
|
|
||||||
|
void SGEnviro::getFOV( float &w, float &h ) {
|
||||||
|
w = fov_width;
|
||||||
|
h = fov_height;
|
||||||
|
}
|
||||||
@@ -0,0 +1,255 @@
|
|||||||
|
// Visual environment helper class
|
||||||
|
//
|
||||||
|
// Written by Harald JOHNSEN, started April 2005.
|
||||||
|
//
|
||||||
|
// Copyright (C) 2005 Harald JOHNSEN - hjohnsen@evc.net
|
||||||
|
//
|
||||||
|
// This program is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU General Public License as
|
||||||
|
// published by the Free Software Foundation; either version 2 of the
|
||||||
|
// License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This program is distributed in the hope that it will be useful, but
|
||||||
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
//
|
||||||
|
#ifndef _VISUAL_ENVIRO_HXX
|
||||||
|
#define _VISUAL_ENVIRO_HXX
|
||||||
|
|
||||||
|
#include <simgear/compiler.h>
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
|
||||||
|
class SGLightning;
|
||||||
|
class SGSampleGroup;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Simulate some echo on a weather radar.
|
||||||
|
* Container class for the wx radar instrument.
|
||||||
|
*/
|
||||||
|
class SGWxRadarEcho {
|
||||||
|
public:
|
||||||
|
SGWxRadarEcho(float _heading, float _alt, float _radius, float _dist,
|
||||||
|
double _LWC, bool _lightning, int _cloudId ) :
|
||||||
|
heading( _heading ),
|
||||||
|
alt ( _alt ),
|
||||||
|
radius ( _radius ),
|
||||||
|
dist ( _dist ),
|
||||||
|
LWC ( _LWC ),
|
||||||
|
lightning ( _lightning ),
|
||||||
|
cloudId ( _cloudId )
|
||||||
|
{}
|
||||||
|
|
||||||
|
/** the heading in radian is versus north */
|
||||||
|
float heading;
|
||||||
|
float alt, radius, dist;
|
||||||
|
/** reflectivity converted to liquid water content. */
|
||||||
|
double LWC;
|
||||||
|
/** if true then this data is for a lightning else it is for water echo. */
|
||||||
|
bool lightning;
|
||||||
|
/** Unique identifier of cloud */
|
||||||
|
int cloudId;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::vector<SGWxRadarEcho> list_of_SGWxRadarEcho;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Visual environment helper class.
|
||||||
|
*/
|
||||||
|
class SGEnviro {
|
||||||
|
friend class SGLightning;
|
||||||
|
private:
|
||||||
|
void DrawCone2(float baseRadius, float height, int slices, bool down, double rain_norm, double speed);
|
||||||
|
void lt_update(void);
|
||||||
|
|
||||||
|
bool view_in_cloud;
|
||||||
|
bool precipitation_enable_state;
|
||||||
|
float precipitation_density;
|
||||||
|
float precipitation_max_alt;
|
||||||
|
bool turbulence_enable_state;
|
||||||
|
double last_cloud_turbulence, cloud_turbulence;
|
||||||
|
bool lightning_enable_state;
|
||||||
|
double elapsed_time, dt;
|
||||||
|
SGVec4f fog_color;
|
||||||
|
SGMatrixf transform;
|
||||||
|
double last_lon, last_lat, last_alt;
|
||||||
|
SGSampleGroup *sampleGroup;
|
||||||
|
bool snd_active, snd_playing;
|
||||||
|
double snd_timer, snd_wait, snd_pos_lat, snd_pos_lon, snd_dist;
|
||||||
|
double min_time_before_lt;
|
||||||
|
|
||||||
|
float fov_width, fov_height;
|
||||||
|
|
||||||
|
/** a list of all the radar echo. */
|
||||||
|
list_of_SGWxRadarEcho radarEcho;
|
||||||
|
static SGVec3f min_light;
|
||||||
|
static float streak_bright_nearmost_layer,
|
||||||
|
streak_bright_farmost_layer,
|
||||||
|
streak_period_max,
|
||||||
|
streak_period_change_per_kt,
|
||||||
|
streak_period_min,
|
||||||
|
streak_length_min,
|
||||||
|
streak_length_change_per_kt,
|
||||||
|
streak_length_max;
|
||||||
|
static int streak_count_min, streak_count_max;
|
||||||
|
static float cone_base_radius,
|
||||||
|
cone_height;
|
||||||
|
|
||||||
|
public:
|
||||||
|
SGEnviro();
|
||||||
|
~SGEnviro();
|
||||||
|
|
||||||
|
/** Read the config from the precipitation rendering config properties.
|
||||||
|
* @param precip_rendering_cfgNode "/sim/rendering/precipitation" in fg
|
||||||
|
* Set from whatever info present in the
|
||||||
|
* subnodes passed, substituting hardwired defaults for missing fields.
|
||||||
|
* If NULL is given, do nothing.
|
||||||
|
*/
|
||||||
|
void config(const class SGPropertyNode* precip_rendering_cfgNode);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forward a few states used for renderings.
|
||||||
|
*/
|
||||||
|
void startOfFrame( SGVec3f p, SGVec3f up, double lon, double lat, double alt, double delta_time);
|
||||||
|
|
||||||
|
void endOfFrame(void);
|
||||||
|
|
||||||
|
#if 0
|
||||||
|
/**
|
||||||
|
* Whenever a cloud is drawn we check his 'impact' on the environment.
|
||||||
|
* @param heading direction of cloud in radians
|
||||||
|
* @param alt asl of cloud in meters
|
||||||
|
* @param radius radius of cloud in meters
|
||||||
|
* @param family cloud family
|
||||||
|
* @param dist squared dist to cloud in meters
|
||||||
|
*/
|
||||||
|
void callback_cloud(float heading, float alt, float radius, int family, float dist, int cloudId);
|
||||||
|
#endif
|
||||||
|
void drawRain(double pitch, double roll, double heading, double hspeed, double rain_norm);
|
||||||
|
/**
|
||||||
|
* Draw rain or snow precipitation around the viewer.
|
||||||
|
* @param rain_norm rain normalized intensity given by metar class
|
||||||
|
* @param snow_norm snow normalized intensity given by metar class
|
||||||
|
* @param hail_norm hail normalized intensity given by metar class
|
||||||
|
* @param pitch pitch rotation of viewer
|
||||||
|
* @param roll roll rotation of viewer
|
||||||
|
* @param hspeed moving horizontal speed of viewer in kt
|
||||||
|
*/
|
||||||
|
void drawPrecipitation(double rain_norm, double snow_norm, double hail_norm,
|
||||||
|
double pitch, double roll, double heading, double hspeed);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Draw the lightnings spawned by cumulo nimbus.
|
||||||
|
*/
|
||||||
|
void drawLightning(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forward the fog color used by the rain rendering.
|
||||||
|
* @param adj_fog_color color of the fog
|
||||||
|
*/
|
||||||
|
void setLight(SGVec4f adj_fog_color);
|
||||||
|
|
||||||
|
// this can be queried to add some turbulence for example
|
||||||
|
bool is_view_in_cloud(void) const;
|
||||||
|
void set_view_in_cloud(bool incloud);
|
||||||
|
double get_cloud_turbulence(void) const;
|
||||||
|
|
||||||
|
// Clouds
|
||||||
|
// return the size of the memory pool used by texture impostors
|
||||||
|
int get_clouds_CacheSize(void) const;
|
||||||
|
int get_CacheResolution(void) const;
|
||||||
|
float get_clouds_visibility(void) const;
|
||||||
|
float get_clouds_density(void) const;
|
||||||
|
bool get_clouds_enable_state(void) const;
|
||||||
|
bool get_turbulence_enable_state(void) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Set the size of the impostor texture cache for 3D clouds.
|
||||||
|
* @param sizeKb size of the texture pool in Kb
|
||||||
|
*/
|
||||||
|
void set_clouds_CacheSize(int sizeKb);
|
||||||
|
/**
|
||||||
|
* Set the resolution of the impostor texture for 3D clouds.
|
||||||
|
* @param resolutionPixels size of each texture in pixels (64|128|256)
|
||||||
|
*/
|
||||||
|
void set_CacheResolution(int resolutionPixels);
|
||||||
|
/**
|
||||||
|
* Set the maximum range used when drawing clouds.
|
||||||
|
* Clouds are blended from totaly transparent at max range to totaly opaque around the viewer
|
||||||
|
* @param distance in meters
|
||||||
|
*/
|
||||||
|
void set_clouds_visibility(float distance);
|
||||||
|
/**
|
||||||
|
* Set the proportion of clouds that will be rendered to limit drop in FPS.
|
||||||
|
* @param density 0..100 no clouds drawn when density == 0, all are drawn when density == 100
|
||||||
|
*/
|
||||||
|
void set_clouds_density(float density);
|
||||||
|
/**
|
||||||
|
* Enable or disable the use of 3D clouds.
|
||||||
|
* @param enable when false we draw the 2D layers
|
||||||
|
*/
|
||||||
|
void set_clouds_enable_state(bool enable);
|
||||||
|
/**
|
||||||
|
* Enable or disable the use of proximity cloud turbulence.
|
||||||
|
* @param enable when true the turbulence is computed based on type of cloud around the AC
|
||||||
|
*/
|
||||||
|
void set_turbulence_enable_state(bool enable);
|
||||||
|
|
||||||
|
// rain/snow
|
||||||
|
float get_precipitation_density(void) const;
|
||||||
|
bool get_precipitation_enable_state(void) const;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Decrease the precipitation density to the given percentage.
|
||||||
|
* (Only show the given percentage of rain streaks etc.)
|
||||||
|
* Default precipitation density upon construction is 100.0.
|
||||||
|
* @param density 0.0 to 100.0
|
||||||
|
*/
|
||||||
|
void set_precipitation_density(float density);
|
||||||
|
/**
|
||||||
|
* Enable or disable the rendering of precipitation around the viewer.
|
||||||
|
* @param enable when true we will draw precipitation depending on metar data
|
||||||
|
*/
|
||||||
|
void set_precipitation_enable_state(bool enable);
|
||||||
|
|
||||||
|
// others
|
||||||
|
bool get_lightning_enable_state(void) const;
|
||||||
|
/**
|
||||||
|
* Enable or disable the rendering of lightning and the thunder sound.
|
||||||
|
* @param enable when true we will draw lightning spwaned by cumulonimbus
|
||||||
|
*/
|
||||||
|
void set_lightning_enable_state(bool enable);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Spawn a new lighning at specified lon/lat.
|
||||||
|
* @param lon position of the new lightning
|
||||||
|
* @param lat position of the new lightning
|
||||||
|
* @param alt asl of the starting point of the lightning in meters
|
||||||
|
*/
|
||||||
|
void addLightning(double lon, double lat, double alt);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Forward the sound manager instance to be able to play samples.
|
||||||
|
* @param mgr a running sound manager
|
||||||
|
*/
|
||||||
|
void set_sampleGroup(SGSampleGroup *sgr);
|
||||||
|
|
||||||
|
void setFOV( float w, float h );
|
||||||
|
void getFOV( float &w, float &h );
|
||||||
|
|
||||||
|
list_of_SGWxRadarEcho *get_radar_echo(void);
|
||||||
|
|
||||||
|
SGMatrixf *get_transform(void) { return &transform; }
|
||||||
|
};
|
||||||
|
|
||||||
|
extern SGEnviro sgEnviro;
|
||||||
|
|
||||||
|
#endif // _VISUAL_ENVIRO_HXX
|
||||||
@@ -1,3 +0,0 @@
|
|||||||
.deps
|
|
||||||
Makefile
|
|
||||||
Makefile.in
|
|
||||||
@@ -0,0 +1,35 @@
|
|||||||
|
|
||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HEADERS
|
||||||
|
celestialBody.hxx
|
||||||
|
ephemeris.hxx
|
||||||
|
jupiter.hxx
|
||||||
|
mars.hxx
|
||||||
|
mercury.hxx
|
||||||
|
moonpos.hxx
|
||||||
|
neptune.hxx
|
||||||
|
pluto.hxx
|
||||||
|
saturn.hxx
|
||||||
|
star.hxx
|
||||||
|
stardata.hxx
|
||||||
|
uranus.hxx
|
||||||
|
venus.hxx
|
||||||
|
)
|
||||||
|
|
||||||
|
set(SOURCES
|
||||||
|
celestialBody.cxx
|
||||||
|
ephemeris.cxx
|
||||||
|
jupiter.cxx
|
||||||
|
mars.cxx
|
||||||
|
mercury.cxx
|
||||||
|
moonpos.cxx
|
||||||
|
neptune.cxx
|
||||||
|
saturn.cxx
|
||||||
|
star.cxx
|
||||||
|
stardata.cxx
|
||||||
|
uranus.cxx
|
||||||
|
venus.cxx
|
||||||
|
)
|
||||||
|
|
||||||
|
simgear_component(ephem ephemeris "${SOURCES}" "${HEADERS}")
|
||||||
@@ -15,19 +15,15 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#ifdef SG_MATH_EXCEPTION_CLASH
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "celestialBody.hxx"
|
#include "celestialBody.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -27,9 +26,9 @@
|
|||||||
#ifndef _CELESTIALBODY_H_
|
#ifndef _CELESTIALBODY_H_
|
||||||
#define _CELESTIALBODY_H_
|
#define _CELESTIALBODY_H_
|
||||||
|
|
||||||
#ifndef __cplusplus
|
#ifndef __cplusplus
|
||||||
# error This library requires C++
|
# error This library requires C++
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
#include <simgear/constants.h>
|
#include <simgear/constants.h>
|
||||||
@@ -82,8 +81,8 @@ public:
|
|||||||
double getRightAscension();
|
double getRightAscension();
|
||||||
double getDeclination();
|
double getDeclination();
|
||||||
double getMagnitude();
|
double getMagnitude();
|
||||||
double getLon();
|
double getLon() const;
|
||||||
double getLat();
|
double getLat() const;
|
||||||
void updatePosition(double mjd, Star *ourSun);
|
void updatePosition(double mjd, Star *ourSun);
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -91,12 +90,12 @@ inline double CelestialBody::getRightAscension() { return rightAscension; }
|
|||||||
inline double CelestialBody::getDeclination() { return declination; }
|
inline double CelestialBody::getDeclination() { return declination; }
|
||||||
inline double CelestialBody::getMagnitude() { return magnitude; }
|
inline double CelestialBody::getMagnitude() { return magnitude; }
|
||||||
|
|
||||||
inline double CelestialBody::getLon()
|
inline double CelestialBody::getLon() const
|
||||||
{
|
{
|
||||||
return lonEcl;
|
return lonEcl;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double CelestialBody::getLat()
|
inline double CelestialBody::getLat() const
|
||||||
{
|
{
|
||||||
return latEcl;
|
return latEcl;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -15,13 +15,15 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
|
||||||
@@ -29,7 +31,7 @@
|
|||||||
|
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SGEphemeris::SGEphemeris( const string &path ) {
|
SGEphemeris::SGEphemeris( const std::string &path ) {
|
||||||
our_sun = new Star;
|
our_sun = new Star;
|
||||||
moon = new MoonPos;
|
moon = new MoonPos;
|
||||||
mercury = new Mercury;
|
mercury = new Mercury;
|
||||||
@@ -40,9 +42,8 @@ SGEphemeris::SGEphemeris( const string &path ) {
|
|||||||
uranus = new Uranus;
|
uranus = new Uranus;
|
||||||
neptune = new Neptune;
|
neptune = new Neptune;
|
||||||
nplanets = 7;
|
nplanets = 7;
|
||||||
for ( int i = 0; i < nplanets; ++i ) {
|
for ( int i = 0; i < nplanets; ++i )
|
||||||
sgdSetVec3( planets[i], 0.0, 0.0, 0.0 );
|
planets[i] = SGVec3d::zeros();
|
||||||
}
|
|
||||||
stars = new SGStarData( SGPath(path) );
|
stars = new SGStarData( SGPath(path) );
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -19,10 +19,9 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
@@ -30,8 +29,7 @@
|
|||||||
#ifndef _EPHEMERIS_HXX
|
#ifndef _EPHEMERIS_HXX
|
||||||
#define _EPHEMERIS_HXX
|
#define _EPHEMERIS_HXX
|
||||||
|
|
||||||
|
#include <string>
|
||||||
#include <plib/sg.h>
|
|
||||||
|
|
||||||
#include <simgear/ephemeris/star.hxx>
|
#include <simgear/ephemeris/star.hxx>
|
||||||
#include <simgear/ephemeris/moonpos.hxx>
|
#include <simgear/ephemeris/moonpos.hxx>
|
||||||
@@ -44,6 +42,9 @@
|
|||||||
#include <simgear/ephemeris/neptune.hxx>
|
#include <simgear/ephemeris/neptune.hxx>
|
||||||
#include <simgear/ephemeris/stardata.hxx>
|
#include <simgear/ephemeris/stardata.hxx>
|
||||||
|
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
#include <simgear/misc/sg_path.hxx>
|
||||||
|
|
||||||
|
|
||||||
/** Ephemeris class
|
/** Ephemeris class
|
||||||
*
|
*
|
||||||
@@ -84,7 +85,7 @@ class SGEphemeris {
|
|||||||
// planets[i][1] = Declination
|
// planets[i][1] = Declination
|
||||||
// planets[i][2] = Magnitude
|
// planets[i][2] = Magnitude
|
||||||
int nplanets;
|
int nplanets;
|
||||||
sgdVec3 planets[7];
|
SGVec3d planets[7];
|
||||||
|
|
||||||
SGStarData *stars;
|
SGStarData *stars;
|
||||||
|
|
||||||
@@ -96,7 +97,7 @@ public:
|
|||||||
* calling the constructor you need to provide a path pointing to
|
* calling the constructor you need to provide a path pointing to
|
||||||
* your star database file.
|
* your star database file.
|
||||||
* @param path path to your star database */
|
* @param path path to your star database */
|
||||||
SGEphemeris( const string &path );
|
SGEphemeris( const std::string &path );
|
||||||
|
|
||||||
/** Destructor */
|
/** Destructor */
|
||||||
~SGEphemeris( void );
|
~SGEphemeris( void );
|
||||||
@@ -156,7 +157,8 @@ public:
|
|||||||
* the second is the declination, and the third is the magnitude.
|
* the second is the declination, and the third is the magnitude.
|
||||||
* @return planets array
|
* @return planets array
|
||||||
*/
|
*/
|
||||||
inline sgdVec3 *getPlanets() { return planets; }
|
inline SGVec3d *getPlanets() { return planets; }
|
||||||
|
inline const SGVec3d *getPlanets() const { return planets; }
|
||||||
|
|
||||||
/** @return the numbers of defined stars. */
|
/** @return the numbers of defined stars. */
|
||||||
inline int getNumStars() const { return stars->getNumStars(); }
|
inline int getNumStars() const { return stars->getNumStars(); }
|
||||||
@@ -168,7 +170,8 @@ public:
|
|||||||
* third is the magnitude.
|
* third is the magnitude.
|
||||||
* @returns star array
|
* @returns star array
|
||||||
*/
|
*/
|
||||||
inline sgdVec3 *getStars() { return stars->getStars(); }
|
inline SGVec3d *getStars() { return stars->getStars(); }
|
||||||
|
inline const SGVec3d *getStars() const { return stars->getStars(); }
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,18 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "jupiter.hxx"
|
#include "jupiter.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,17 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "mars.hxx"
|
#include "mars.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,17 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "mercury.hxx"
|
#include "mercury.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -28,9 +27,6 @@
|
|||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
// #include <FDM/flight.hxx>
|
// #include <FDM/flight.hxx>
|
||||||
@@ -172,7 +168,7 @@ void MoonPos::updatePosition(double mjd, double lst, double lat, Star *ourSun)
|
|||||||
// SG_LOG( SG_GENERAL, SG_INFO, "rho = " << rho );
|
// SG_LOG( SG_GENERAL, SG_INFO, "rho = " << rho );
|
||||||
|
|
||||||
if (geoRa < 0)
|
if (geoRa < 0)
|
||||||
geoRa += (2*SGD_PI);
|
geoRa += SGD_2PI;
|
||||||
|
|
||||||
HA = lst - (3.8197186 * geoRa);
|
HA = lst - (3.8197186 * geoRa);
|
||||||
/* SG_LOG( SG_GENERAL, SG_INFO, "t->getLst() = " << t->getLst()
|
/* SG_LOG( SG_GENERAL, SG_INFO, "t->getLst() = " << t->getLst()
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,17 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "saturn.hxx"
|
#include "saturn.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,18 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
@@ -80,7 +75,7 @@ void Star::updatePosition(double mjd)
|
|||||||
double
|
double
|
||||||
actTime, eccAnom,
|
actTime, eccAnom,
|
||||||
xv, yv, v, r,
|
xv, yv, v, r,
|
||||||
xe, ye, ze, ecl;
|
xe, ecl;
|
||||||
|
|
||||||
updateOrbElements(mjd);
|
updateOrbElements(mjd);
|
||||||
|
|
||||||
|
|||||||
+26
-14
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
@@ -35,6 +34,7 @@ class Star : public CelestialBody
|
|||||||
private:
|
private:
|
||||||
|
|
||||||
double xs, ys; // the sun's rectangular geocentric coordinates
|
double xs, ys; // the sun's rectangular geocentric coordinates
|
||||||
|
double ye, ze; // the sun's rectangularequatorial rectangular geocentric coordinates
|
||||||
double distance; // the sun's distance to the earth
|
double distance; // the sun's distance to the earth
|
||||||
|
|
||||||
public:
|
public:
|
||||||
@@ -43,35 +43,47 @@ public:
|
|||||||
Star ();
|
Star ();
|
||||||
~Star();
|
~Star();
|
||||||
void updatePosition(double mjd);
|
void updatePosition(double mjd);
|
||||||
double getM();
|
double getM() const;
|
||||||
double getw();
|
double getw() const;
|
||||||
double getxs();
|
double getxs() const;
|
||||||
double getys();
|
double getys() const;
|
||||||
double getDistance();
|
double getye() const;
|
||||||
|
double getze() const;
|
||||||
|
double getDistance() const;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
inline double Star::getM()
|
inline double Star::getM() const
|
||||||
{
|
{
|
||||||
return M;
|
return M;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double Star::getw()
|
inline double Star::getw() const
|
||||||
{
|
{
|
||||||
return w;
|
return w;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double Star::getxs()
|
inline double Star::getxs() const
|
||||||
{
|
{
|
||||||
return xs;
|
return xs;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double Star::getys()
|
inline double Star::getys() const
|
||||||
{
|
{
|
||||||
return ys;
|
return ys;
|
||||||
}
|
}
|
||||||
|
|
||||||
inline double Star::getDistance()
|
inline double Star::getye() const
|
||||||
|
{
|
||||||
|
return ye;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Star::getze() const
|
||||||
|
{
|
||||||
|
return ze;
|
||||||
|
}
|
||||||
|
|
||||||
|
inline double Star::getDistance() const
|
||||||
{
|
{
|
||||||
return distance;
|
return distance;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,34 +14,32 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
|
#ifdef HAVE_CONFIG_H
|
||||||
|
# include <simgear_config.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#include <simgear/debug/logstream.hxx>
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
#include <simgear/misc/sg_path.hxx>
|
||||||
#include <simgear/misc/sgstream.hxx>
|
#include <simgear/misc/sgstream.hxx>
|
||||||
|
|
||||||
#include "stardata.hxx"
|
#include "stardata.hxx"
|
||||||
|
|
||||||
#if defined (_MSC_VER)
|
#if defined (_MSC_VER)
|
||||||
SG_USING_STD(getline);
|
using std::getline;
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
// Constructor
|
using std::string;
|
||||||
SGStarData::SGStarData() :
|
|
||||||
nstars(0)
|
|
||||||
{
|
|
||||||
}
|
|
||||||
|
|
||||||
SGStarData::SGStarData( SGPath path ) :
|
// Constructor
|
||||||
nstars(0)
|
SGStarData::SGStarData( const SGPath& path )
|
||||||
{
|
{
|
||||||
data_path = SGPath( path );
|
load(path);
|
||||||
load();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -50,31 +48,28 @@ SGStarData::~SGStarData() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
bool SGStarData::load() {
|
bool SGStarData::load( const SGPath& path ) {
|
||||||
|
|
||||||
// -dw- avoid local data > 32k error by dynamic allocation of the
|
_stars.clear();
|
||||||
// array, problem for some compilers
|
|
||||||
stars = new sgdVec3[SG_MAX_STARS];
|
|
||||||
|
|
||||||
// build the full path name to the stars data base file
|
// build the full path name to the stars data base file
|
||||||
data_path.append( "stars" );
|
SGPath tmp = path;
|
||||||
SG_LOG( SG_ASTRO, SG_INFO, " Loading stars from " << data_path.str() );
|
tmp.append( "stars" );
|
||||||
|
SG_LOG( SG_ASTRO, SG_INFO, " Loading stars from " << tmp.str() );
|
||||||
|
|
||||||
sg_gzifstream in( data_path.str() );
|
sg_gzifstream in( tmp.str() );
|
||||||
if ( ! in.is_open() ) {
|
if ( ! in.is_open() ) {
|
||||||
SG_LOG( SG_ASTRO, SG_ALERT, "Cannot open star file: "
|
SG_LOG( SG_ASTRO, SG_ALERT, "Cannot open star file: "
|
||||||
<< data_path.str() );
|
<< tmp.str() );
|
||||||
exit(-1);
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
double ra, dec, mag;
|
double ra, dec, mag;
|
||||||
char c;
|
char c;
|
||||||
string name;
|
string name;
|
||||||
|
|
||||||
nstars = 0;
|
|
||||||
|
|
||||||
// read in each line of the file
|
// read in each line of the file
|
||||||
while ( ! in.eof() && nstars < SG_MAX_STARS ) {
|
while ( ! in.eof() ) {
|
||||||
in >> skipcomment;
|
in >> skipcomment;
|
||||||
|
|
||||||
getline( in, name, ',' );
|
getline( in, name, ',' );
|
||||||
@@ -114,13 +109,10 @@ bool SGStarData::load() {
|
|||||||
in >> mag;
|
in >> mag;
|
||||||
|
|
||||||
// cout << " star data = " << ra << " " << dec << " " << mag << endl;
|
// cout << " star data = " << ra << " " << dec << " " << mag << endl;
|
||||||
|
_stars.push_back(SGVec3d(ra, dec, mag));
|
||||||
sgdSetVec3( stars[nstars], ra, dec, mag );
|
|
||||||
|
|
||||||
++nstars;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SG_LOG( SG_ASTRO, SG_INFO, " Loaded " << nstars << " stars" );
|
SG_LOG( SG_ASTRO, SG_INFO, " Loaded " << _stars.size() << " stars" );
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,10 +14,9 @@
|
|||||||
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
// Library General Public License for more details.
|
// Library General Public License for more details.
|
||||||
//
|
//
|
||||||
// You should have received a copy of the GNU Library General Public
|
// You should have received a copy of the GNU General Public License
|
||||||
// License along with this library; if not, write to the
|
// along with this program; if not, write to the Free Software
|
||||||
// Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
// Boston, MA 02111-1307, USA.
|
|
||||||
//
|
//
|
||||||
// $Id$
|
// $Id$
|
||||||
|
|
||||||
@@ -25,37 +24,28 @@
|
|||||||
#ifndef _SG_STARDATA_HXX
|
#ifndef _SG_STARDATA_HXX
|
||||||
#define _SG_STARDATA_HXX
|
#define _SG_STARDATA_HXX
|
||||||
|
|
||||||
|
#include <vector>
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
|
||||||
#include <plib/sg.h>
|
class SGPath;
|
||||||
|
|
||||||
#include <simgear/misc/sg_path.hxx>
|
|
||||||
|
|
||||||
|
|
||||||
#define SG_MAX_STARS 850
|
|
||||||
|
|
||||||
|
|
||||||
class SGStarData {
|
class SGStarData {
|
||||||
|
|
||||||
int nstars;
|
|
||||||
sgdVec3 *stars;
|
|
||||||
|
|
||||||
SGPath data_path;
|
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
// Constructor
|
// Constructor
|
||||||
SGStarData();
|
SGStarData( const SGPath& path );
|
||||||
SGStarData( SGPath path );
|
|
||||||
|
|
||||||
// Destructor
|
// Destructor
|
||||||
~SGStarData();
|
~SGStarData();
|
||||||
|
|
||||||
// load the stars database
|
// load the stars database
|
||||||
bool load();
|
bool load( const SGPath& path );
|
||||||
|
|
||||||
// stars
|
// stars
|
||||||
inline int getNumStars() const { return nstars; }
|
inline int getNumStars() const { return _stars.size(); }
|
||||||
inline sgdVec3 *getStars() { return stars; }
|
inline SGVec3d *getStars() { return &(_stars[0]); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::vector<SGVec3d> _stars;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -15,17 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "uranus.hxx"
|
#include "uranus.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -15,17 +15,13 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|
||||||
#ifdef __BORLANDC__
|
|
||||||
# define exception c_exception
|
|
||||||
#endif
|
|
||||||
#include <math.h>
|
#include <math.h>
|
||||||
|
|
||||||
#include "venus.hxx"
|
#include "venus.hxx"
|
||||||
|
|||||||
@@ -15,10 +15,9 @@
|
|||||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
* Library General Public License for more details.
|
* Library General Public License for more details.
|
||||||
*
|
*
|
||||||
* You should have received a copy of the GNU Library General Public
|
* You should have received a copy of the GNU General Public License
|
||||||
* License along with this library; if not, write to the
|
* along with this program; if not, write to the Free Software
|
||||||
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
* Boston, MA 02111-1307, USA.
|
|
||||||
*
|
*
|
||||||
* $Id$
|
* $Id$
|
||||||
**************************************************************************/
|
**************************************************************************/
|
||||||
|
|||||||
@@ -0,0 +1,65 @@
|
|||||||
|
include (SimGearComponent)
|
||||||
|
|
||||||
|
set(HLA_HEADERS
|
||||||
|
RTIData.hxx
|
||||||
|
HLAArrayDataElement.hxx
|
||||||
|
HLAArrayDataType.hxx
|
||||||
|
HLABasicDataElement.hxx
|
||||||
|
HLABasicDataType.hxx
|
||||||
|
HLADataElement.hxx
|
||||||
|
HLADataType.hxx
|
||||||
|
HLADataTypeVisitor.hxx
|
||||||
|
HLAEnumeratedDataElement.hxx
|
||||||
|
HLAEnumeratedDataType.hxx
|
||||||
|
HLAFixedRecordDataElement.hxx
|
||||||
|
HLAFixedRecordDataType.hxx
|
||||||
|
HLAFederate.hxx
|
||||||
|
HLAInteractionClass.hxx
|
||||||
|
HLALocation.hxx
|
||||||
|
HLAObjectClass.hxx
|
||||||
|
HLAObjectInstance.hxx
|
||||||
|
HLAOMTXmlVisitor.hxx
|
||||||
|
HLAPropertyDataElement.hxx
|
||||||
|
HLARawDataElement.hxx
|
||||||
|
HLAVariantDataElement.hxx
|
||||||
|
HLAVariantDataType.hxx
|
||||||
|
)
|
||||||
|
|
||||||
|
set(HLA_SOURCES
|
||||||
|
RTIObjectClass.cxx
|
||||||
|
RTIObjectInstance.cxx
|
||||||
|
RTIFederate.cxx
|
||||||
|
HLAArrayDataElement.cxx
|
||||||
|
HLAArrayDataType.cxx
|
||||||
|
HLABasicDataElement.cxx
|
||||||
|
HLABasicDataType.cxx
|
||||||
|
HLADataElement.cxx
|
||||||
|
HLADataType.cxx
|
||||||
|
HLAEnumeratedDataElement.cxx
|
||||||
|
HLAEnumeratedDataType.cxx
|
||||||
|
HLAFederate.cxx
|
||||||
|
HLAFixedRecordDataElement.cxx
|
||||||
|
HLAFixedRecordDataType.cxx
|
||||||
|
HLAObjectClass.cxx
|
||||||
|
HLAObjectInstance.cxx
|
||||||
|
HLAOMTXmlVisitor.cxx
|
||||||
|
HLAPropertyDataElement.cxx
|
||||||
|
HLARawDataElement.cxx
|
||||||
|
HLAVariantDataElement.cxx
|
||||||
|
HLAVariantDataType.cxx
|
||||||
|
)
|
||||||
|
simgear_component(hla hla "${HLA_SOURCES}" "${HLA_HEADERS}")
|
||||||
|
|
||||||
|
if(RTI_FOUND)
|
||||||
|
set(HLA13_HEADERS
|
||||||
|
HLA13Federate.hxx
|
||||||
|
)
|
||||||
|
set(HLA13_SOURCES
|
||||||
|
RTI13ObjectClass.cxx
|
||||||
|
RTI13ObjectInstance.cxx
|
||||||
|
RTI13Federate.cxx
|
||||||
|
HLA13Federate.cxx
|
||||||
|
)
|
||||||
|
simgear_component(hla13 hla "${HLA13_SOURCES}" "${HLA13_HEADERS}")
|
||||||
|
set_property(TARGET sghla13 APPEND PROPERTY COMPILE_FLAGS "-I${RTI_INCLUDE_DIR}")
|
||||||
|
endif()
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLA13Federate.hxx"
|
||||||
|
|
||||||
|
#include "RTI13Federate.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLA13Federate::HLA13Federate() :
|
||||||
|
HLAFederate(new RTI13Federate)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLA13Federate::~HLA13Federate()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,33 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLA13Federate_hxx
|
||||||
|
#define HLA13Federate_hxx
|
||||||
|
|
||||||
|
#include "HLAFederate.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLA13Federate : public HLAFederate {
|
||||||
|
public:
|
||||||
|
HLA13Federate();
|
||||||
|
virtual ~HLA13Federate();
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,313 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLAArrayDataElement.hxx"
|
||||||
|
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLAAbstractArrayDataElement::HLAAbstractArrayDataElement(const HLAArrayDataType* dataType) :
|
||||||
|
_dataType(dataType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAAbstractArrayDataElement::~HLAAbstractArrayDataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractArrayDataElement::decode(HLADecodeStream& stream)
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return false;
|
||||||
|
return _dataType->decode(stream, *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractArrayDataElement::encode(HLAEncodeStream& stream) const
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return false;
|
||||||
|
return _dataType->encode(stream, *this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAArrayDataType*
|
||||||
|
HLAAbstractArrayDataElement::getDataType() const
|
||||||
|
{
|
||||||
|
return _dataType.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractArrayDataElement::setDataType(const HLADataType* dataType)
|
||||||
|
{
|
||||||
|
const HLAArrayDataType* arrayDataType = dynamic_cast<const HLAArrayDataType*>(dataType);
|
||||||
|
if (!arrayDataType) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLAArrayDataType: unable to set data type!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_dataType = arrayDataType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataType*
|
||||||
|
HLAAbstractArrayDataElement::getElementDataType() const
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return 0;
|
||||||
|
return _dataType->getElementDataType();
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HLAArrayDataElement::DataElementFactory::~DataElementFactory()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAArrayDataElement::HLAArrayDataElement(const HLAArrayDataType* dataType) :
|
||||||
|
HLAAbstractArrayDataElement(dataType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAArrayDataElement::~HLAArrayDataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAArrayDataElement::setNumElements(unsigned size)
|
||||||
|
{
|
||||||
|
unsigned oldSize = _elementVector.size();
|
||||||
|
if (size == oldSize)
|
||||||
|
return true;
|
||||||
|
_elementVector.resize(size);
|
||||||
|
for (unsigned i = oldSize; i < size; ++i)
|
||||||
|
_elementVector[i] = newElement(i);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAArrayDataElement::decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
HLADataElement* dataElement = getElement(i);
|
||||||
|
if (!dataElement)
|
||||||
|
return false;
|
||||||
|
return dataElement->decode(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
HLAArrayDataElement::getNumElements() const
|
||||||
|
{
|
||||||
|
return _elementVector.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAArrayDataElement::encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
const HLADataElement* dataElement = getElement(i);
|
||||||
|
if (!dataElement)
|
||||||
|
return false;
|
||||||
|
return dataElement->encode(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataElement*
|
||||||
|
HLAArrayDataElement::getElement(unsigned index) const
|
||||||
|
{
|
||||||
|
if (_elementVector.size() <= index)
|
||||||
|
return 0;
|
||||||
|
return _elementVector[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement*
|
||||||
|
HLAArrayDataElement::getElement(unsigned index)
|
||||||
|
{
|
||||||
|
if (_elementVector.size() <= index)
|
||||||
|
return 0;
|
||||||
|
return _elementVector[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement*
|
||||||
|
HLAArrayDataElement::getOrCreateElement(unsigned index)
|
||||||
|
{
|
||||||
|
if (_elementVector.size() <= index)
|
||||||
|
if (!setNumElements(index + 1))
|
||||||
|
return 0;
|
||||||
|
return _elementVector[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAArrayDataElement::setElement(unsigned index, HLADataElement* value)
|
||||||
|
{
|
||||||
|
unsigned oldSize = _elementVector.size();
|
||||||
|
if (oldSize <= index) {
|
||||||
|
_elementVector.resize(index + 1);
|
||||||
|
for (unsigned j = oldSize; j < index; ++j)
|
||||||
|
_elementVector[j] = newElement(j);
|
||||||
|
}
|
||||||
|
_elementVector[index] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAArrayDataElement::setDataElementFactory(HLAArrayDataElement::DataElementFactory* dataElementFactory)
|
||||||
|
{
|
||||||
|
_dataElementFactory = dataElementFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAArrayDataElement::DataElementFactory*
|
||||||
|
HLAArrayDataElement::getDataElementFactory()
|
||||||
|
{
|
||||||
|
return _dataElementFactory.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement*
|
||||||
|
HLAArrayDataElement::newElement(unsigned index)
|
||||||
|
{
|
||||||
|
if (!_dataElementFactory.valid())
|
||||||
|
return 0;
|
||||||
|
return _dataElementFactory->createElement(*this, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HLAVariantArrayDataElement::HLAVariantArrayDataElement() :
|
||||||
|
HLAAbstractArrayDataElement(0)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAVariantArrayDataElement::~HLAVariantArrayDataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAVariantArrayDataElement::setDataType(const HLADataType* dataType)
|
||||||
|
{
|
||||||
|
const HLAArrayDataType* arrayDataType = dataType->toArrayDataType();
|
||||||
|
if (!arrayDataType) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLAVariantArrayDataType: unable to set data type, dataType is not an array data type!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
const HLAVariantDataType* variantDataType = arrayDataType->getElementDataType()->toVariantDataType();
|
||||||
|
if (!variantDataType) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLAVariantArrayDataType: unable to set data type: arrayDataTypes element data type is no a variant data type!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
_dataType = arrayDataType;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAVariantArrayDataElement::setNumElements(unsigned size)
|
||||||
|
{
|
||||||
|
unsigned oldSize = _elementVector.size();
|
||||||
|
if (size == oldSize)
|
||||||
|
return true;
|
||||||
|
_elementVector.resize(size);
|
||||||
|
for (unsigned i = oldSize; i < size; ++i)
|
||||||
|
_elementVector[i] = newElement();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAVariantArrayDataElement::decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
HLAVariantDataElement* dataElement = getElement(i);
|
||||||
|
if (!dataElement)
|
||||||
|
return false;
|
||||||
|
return dataElement->decode(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
HLAVariantArrayDataElement::getNumElements() const
|
||||||
|
{
|
||||||
|
return _elementVector.size();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAVariantArrayDataElement::encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
const HLADataElement* dataElement = getElement(i);
|
||||||
|
if (!dataElement)
|
||||||
|
return false;
|
||||||
|
return dataElement->encode(stream);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAVariantDataElement*
|
||||||
|
HLAVariantArrayDataElement::getElement(unsigned index) const
|
||||||
|
{
|
||||||
|
if (_elementVector.size() <= index)
|
||||||
|
return 0;
|
||||||
|
return _elementVector[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAVariantDataElement*
|
||||||
|
HLAVariantArrayDataElement::getElement(unsigned index)
|
||||||
|
{
|
||||||
|
if (_elementVector.size() <= index)
|
||||||
|
return 0;
|
||||||
|
return _elementVector[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAVariantDataElement*
|
||||||
|
HLAVariantArrayDataElement::getOrCreateElement(unsigned index)
|
||||||
|
{
|
||||||
|
if (_elementVector.size() <= index)
|
||||||
|
if (!setNumElements(index + 1))
|
||||||
|
return 0;
|
||||||
|
return _elementVector[index].get();
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAVariantArrayDataElement::setElement(unsigned index, HLAVariantDataElement* value)
|
||||||
|
{
|
||||||
|
unsigned oldSize = _elementVector.size();
|
||||||
|
if (oldSize <= index) {
|
||||||
|
_elementVector.resize(index + 1);
|
||||||
|
for (unsigned j = oldSize; j < index; ++j)
|
||||||
|
_elementVector[j] = newElement();
|
||||||
|
}
|
||||||
|
_elementVector[index] = value;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAVariantArrayDataElement::setAlternativeDataElementFactory(HLAVariantArrayDataElement::AlternativeDataElementFactory* alternativeDataElementFactory)
|
||||||
|
{
|
||||||
|
_alternativeDataElementFactory = alternativeDataElementFactory;
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAVariantArrayDataElement::AlternativeDataElementFactory*
|
||||||
|
HLAVariantArrayDataElement::getAlternativeDataElementFactory()
|
||||||
|
{
|
||||||
|
return _alternativeDataElementFactory.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAVariantDataElement*
|
||||||
|
HLAVariantArrayDataElement::newElement()
|
||||||
|
{
|
||||||
|
const HLAArrayDataType* arrayDataType = getDataType();
|
||||||
|
if (!arrayDataType)
|
||||||
|
return 0;
|
||||||
|
const HLADataType* elementDataType = arrayDataType->getElementDataType();
|
||||||
|
if (!elementDataType)
|
||||||
|
return 0;
|
||||||
|
const HLAVariantDataType* variantDataType = elementDataType->toVariantDataType();
|
||||||
|
if (!variantDataType)
|
||||||
|
return 0;
|
||||||
|
HLAVariantDataElement* variantDataElement = new HLAVariantDataElement(variantDataType);
|
||||||
|
variantDataElement->setDataElementFactory(_alternativeDataElementFactory.get());
|
||||||
|
return variantDataElement;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,418 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLAArrayDataElement_hxx
|
||||||
|
#define HLAArrayDataElement_hxx
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <vector>
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
#include "HLAArrayDataType.hxx"
|
||||||
|
#include "HLADataElement.hxx"
|
||||||
|
#include "HLAVariantDataElement.hxx"
|
||||||
|
#include "HLADataTypeVisitor.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLAAbstractArrayDataElement : public HLADataElement {
|
||||||
|
public:
|
||||||
|
HLAAbstractArrayDataElement(const HLAArrayDataType* dataType);
|
||||||
|
virtual ~HLAAbstractArrayDataElement();
|
||||||
|
|
||||||
|
virtual bool decode(HLADecodeStream& stream);
|
||||||
|
virtual bool encode(HLAEncodeStream& stream) const;
|
||||||
|
|
||||||
|
virtual const HLAArrayDataType* getDataType() const;
|
||||||
|
virtual bool setDataType(const HLADataType* dataType);
|
||||||
|
|
||||||
|
const HLADataType* getElementDataType() const;
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned count) = 0;
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i) = 0;
|
||||||
|
|
||||||
|
virtual unsigned getNumElements() const = 0;
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const = 0;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SGSharedPtr<const HLAArrayDataType> _dataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAArrayDataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAArrayDataElement(const HLAArrayDataType* dataType = 0);
|
||||||
|
virtual ~HLAArrayDataElement();
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned size);
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i);
|
||||||
|
virtual unsigned getNumElements() const;
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const;
|
||||||
|
|
||||||
|
const HLADataElement* getElement(unsigned index) const;
|
||||||
|
HLADataElement* getElement(unsigned index);
|
||||||
|
HLADataElement* getOrCreateElement(unsigned index);
|
||||||
|
void setElement(unsigned i, HLADataElement* value);
|
||||||
|
|
||||||
|
class DataElementFactory : public SGReferenced {
|
||||||
|
public:
|
||||||
|
virtual ~DataElementFactory();
|
||||||
|
virtual HLADataElement* createElement(const HLAArrayDataElement&, unsigned) = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
void setDataElementFactory(DataElementFactory* dataElementFactory);
|
||||||
|
DataElementFactory* getDataElementFactory();
|
||||||
|
|
||||||
|
private:
|
||||||
|
HLADataElement* newElement(unsigned index);
|
||||||
|
|
||||||
|
typedef std::vector<SGSharedPtr<HLADataElement> > ElementVector;
|
||||||
|
ElementVector _elementVector;
|
||||||
|
|
||||||
|
SGSharedPtr<DataElementFactory> _dataElementFactory;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Holds an array of variants.
|
||||||
|
// Factors out common code for that use case.
|
||||||
|
class HLAVariantArrayDataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAVariantArrayDataElement();
|
||||||
|
virtual ~HLAVariantArrayDataElement();
|
||||||
|
|
||||||
|
// Overwrite this from the abstract class, need some more checks here
|
||||||
|
virtual bool setDataType(const HLADataType* dataType);
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned size);
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i);
|
||||||
|
virtual unsigned getNumElements() const;
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const;
|
||||||
|
|
||||||
|
const HLAVariantDataElement* getElement(unsigned index) const;
|
||||||
|
HLAVariantDataElement* getElement(unsigned index);
|
||||||
|
HLAVariantDataElement* getOrCreateElement(unsigned index);
|
||||||
|
void setElement(unsigned index, HLAVariantDataElement* value);
|
||||||
|
|
||||||
|
typedef HLAVariantDataElement::DataElementFactory AlternativeDataElementFactory;
|
||||||
|
|
||||||
|
void setAlternativeDataElementFactory(AlternativeDataElementFactory* alternativeDataElementFactory);
|
||||||
|
AlternativeDataElementFactory* getAlternativeDataElementFactory();
|
||||||
|
|
||||||
|
private:
|
||||||
|
HLAVariantDataElement* newElement();
|
||||||
|
|
||||||
|
typedef std::vector<SGSharedPtr<HLAVariantDataElement> > ElementVector;
|
||||||
|
ElementVector _elementVector;
|
||||||
|
|
||||||
|
SGSharedPtr<AlternativeDataElementFactory> _alternativeDataElementFactory;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAStringDataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAStringDataElement(const HLAArrayDataType* dataType = 0) :
|
||||||
|
HLAAbstractArrayDataElement(dataType)
|
||||||
|
{}
|
||||||
|
HLAStringDataElement(const HLAArrayDataType* dataType, const std::string& value) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
const std::string& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
void setValue(const std::string& value)
|
||||||
|
{ _value = value; }
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned count)
|
||||||
|
{
|
||||||
|
_value.resize(count);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
HLATemplateDecodeVisitor<std::string::value_type> visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
_value[i] = visitor.getValue();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual unsigned getNumElements() const
|
||||||
|
{
|
||||||
|
return _value.size();
|
||||||
|
}
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
HLATemplateEncodeVisitor<std::string::value_type> visitor(stream, _value[i]);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAStringData {
|
||||||
|
public:
|
||||||
|
HLAStringData() :
|
||||||
|
_value(new HLAStringDataElement(0))
|
||||||
|
{ }
|
||||||
|
HLAStringData(const std::string& value) :
|
||||||
|
_value(new HLAStringDataElement(0))
|
||||||
|
{ _value->setValue(value); }
|
||||||
|
|
||||||
|
operator const std::string&() const
|
||||||
|
{ return _value->getValue(); }
|
||||||
|
HLAStringData& operator=(const std::string& value)
|
||||||
|
{ _value->setValue(value); return *this; }
|
||||||
|
|
||||||
|
const std::string& getValue() const
|
||||||
|
{ return _value->getValue(); }
|
||||||
|
void setValue(const std::string& value)
|
||||||
|
{ _value->setValue(value); }
|
||||||
|
|
||||||
|
const HLAStringDataElement* getDataElement() const
|
||||||
|
{ return _value.get(); }
|
||||||
|
HLAStringDataElement* getDataElement()
|
||||||
|
{ return _value.get(); }
|
||||||
|
|
||||||
|
const HLAArrayDataType* getDataType() const
|
||||||
|
{ return _value->getDataType(); }
|
||||||
|
void setDataType(const HLAArrayDataType* dataType)
|
||||||
|
{ _value->setDataType(dataType); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGSharedPtr<HLAStringDataElement> _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class HLAVec2DataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAVec2DataElement(const HLAArrayDataType* dataType = 0) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(SGVec2<T>::zeros())
|
||||||
|
{}
|
||||||
|
HLAVec2DataElement(const HLAArrayDataType* dataType, const SGVec2<T>& value) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
const SGVec2<T>& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
void setValue(const SGVec2<T>& value)
|
||||||
|
{ _value = value; }
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned count)
|
||||||
|
{
|
||||||
|
for (unsigned i = 2; i < count; ++i)
|
||||||
|
_value[i] = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
if (i < 2) {
|
||||||
|
HLATemplateDecodeVisitor<typename SGVec2<T>::value_type> visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
_value[i] = visitor.getValue();
|
||||||
|
} else {
|
||||||
|
HLADataTypeDecodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual unsigned getNumElements() const
|
||||||
|
{
|
||||||
|
return 2;
|
||||||
|
}
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
if (i < 2) {
|
||||||
|
HLATemplateEncodeVisitor<typename SGVec2<T>::value_type> visitor(stream, _value[i]);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
} else {
|
||||||
|
HLADataTypeEncodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGVec2<T> _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class HLAVec3DataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAVec3DataElement(const HLAArrayDataType* dataType = 0) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(SGVec3<T>::zeros())
|
||||||
|
{}
|
||||||
|
HLAVec3DataElement(const HLAArrayDataType* dataType, const SGVec3<T>& value) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
const SGVec3<T>& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
void setValue(const SGVec3<T>& value)
|
||||||
|
{ _value = value; }
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned count)
|
||||||
|
{
|
||||||
|
for (unsigned i = 3; i < count; ++i)
|
||||||
|
_value[i] = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
if (i < 3) {
|
||||||
|
HLATemplateDecodeVisitor<typename SGVec3<T>::value_type> visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
_value[i] = visitor.getValue();
|
||||||
|
} else {
|
||||||
|
HLADataTypeDecodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual unsigned getNumElements() const
|
||||||
|
{
|
||||||
|
return 3;
|
||||||
|
}
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
if (i < 3) {
|
||||||
|
HLATemplateEncodeVisitor<typename SGVec3<T>::value_type> visitor(stream, _value[i]);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
} else {
|
||||||
|
HLADataTypeEncodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGVec3<T> _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class HLAVec4DataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAVec4DataElement(const HLAArrayDataType* dataType = 0) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(SGVec4<T>::zeros())
|
||||||
|
{}
|
||||||
|
HLAVec4DataElement(const HLAArrayDataType* dataType, const SGVec4<T>& value) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
const SGVec4<T>& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
void setValue(const SGVec4<T>& value)
|
||||||
|
{ _value = value; }
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned count)
|
||||||
|
{
|
||||||
|
for (unsigned i = 4; i < count; ++i)
|
||||||
|
_value[i] = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
if (i < 4) {
|
||||||
|
HLATemplateDecodeVisitor<typename SGVec4<T>::value_type> visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
_value[i] = visitor.getValue();
|
||||||
|
} else {
|
||||||
|
HLADataTypeDecodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual unsigned getNumElements() const
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
if (i < 4) {
|
||||||
|
HLATemplateEncodeVisitor<typename SGVec4<T>::value_type> visitor(stream, _value[i]);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
} else {
|
||||||
|
HLADataTypeEncodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGVec4<T> _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class HLAQuatDataElement : public HLAAbstractArrayDataElement {
|
||||||
|
public:
|
||||||
|
HLAQuatDataElement(const HLAArrayDataType* dataType = 0) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(SGQuat<T>::zeros())
|
||||||
|
{}
|
||||||
|
HLAQuatDataElement(const HLAArrayDataType* dataType, const SGQuat<T>& value) :
|
||||||
|
HLAAbstractArrayDataElement(dataType),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
const SGQuat<T>& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
void setValue(const SGQuat<T>& value)
|
||||||
|
{ _value = value; }
|
||||||
|
|
||||||
|
virtual bool setNumElements(unsigned count)
|
||||||
|
{
|
||||||
|
for (unsigned i = 4; i < count; ++i)
|
||||||
|
_value[i] = 0;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool decodeElement(HLADecodeStream& stream, unsigned i)
|
||||||
|
{
|
||||||
|
if (i < 4) {
|
||||||
|
HLATemplateDecodeVisitor<typename SGQuat<T>::value_type> visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
_value[i] = visitor.getValue();
|
||||||
|
} else {
|
||||||
|
HLADataTypeDecodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual unsigned getNumElements() const
|
||||||
|
{
|
||||||
|
return 4;
|
||||||
|
}
|
||||||
|
virtual bool encodeElement(HLAEncodeStream& stream, unsigned i) const
|
||||||
|
{
|
||||||
|
if (i < 4) {
|
||||||
|
HLATemplateEncodeVisitor<typename SGQuat<T>::value_type> visitor(stream, _value[i]);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
} else {
|
||||||
|
HLADataTypeEncodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGQuat<T> _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,158 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLAArrayDataType.hxx"
|
||||||
|
|
||||||
|
#include "HLAArrayDataElement.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLAArrayDataType::HLAArrayDataType(const std::string& name) :
|
||||||
|
HLADataType(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAArrayDataType::~HLAArrayDataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAArrayDataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAArrayDataType*
|
||||||
|
HLAArrayDataType::toArrayDataType() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAArrayDataType::setElementDataType(const HLADataType* elementDataType)
|
||||||
|
{
|
||||||
|
// FIXME this only works if we do not reset the alignment to something smaller
|
||||||
|
if (getAlignment() < elementDataType->getAlignment())
|
||||||
|
setAlignment(elementDataType->getAlignment());
|
||||||
|
_elementDataType = elementDataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
///////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HLAFixedArrayDataType::HLAFixedArrayDataType(const std::string& name) :
|
||||||
|
HLAArrayDataType(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAFixedArrayDataType::~HLAFixedArrayDataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAFixedArrayDataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAFixedArrayDataType::decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const
|
||||||
|
{
|
||||||
|
stream.alignOffsetForSize(getAlignment());
|
||||||
|
unsigned numElements = getNumElements();
|
||||||
|
if (!value.setNumElements(numElements))
|
||||||
|
return false;
|
||||||
|
for (unsigned i = 0; i < numElements; ++i)
|
||||||
|
if (!value.decodeElement(stream, i))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAFixedArrayDataType::encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const
|
||||||
|
{
|
||||||
|
stream.alignOffsetForSize(getAlignment());
|
||||||
|
unsigned numElementsType = getNumElements();
|
||||||
|
unsigned numElementsValue = value.getNumElements();
|
||||||
|
unsigned numElements = SGMisc<unsigned>::min(numElementsType, numElementsValue);
|
||||||
|
unsigned i = 0;
|
||||||
|
for (; i < numElements; ++i)
|
||||||
|
if (!value.encodeElement(stream, i))
|
||||||
|
return false;
|
||||||
|
for (; i < numElementsType; ++i) {
|
||||||
|
HLADataTypeEncodeVisitor visitor(stream);
|
||||||
|
getElementDataType()->accept(visitor);
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
/////////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HLAVariableArrayDataType::HLAVariableArrayDataType(const std::string& name) :
|
||||||
|
HLAArrayDataType(name)
|
||||||
|
{
|
||||||
|
setSizeDataType(new HLAUInt32BEDataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAVariableArrayDataType::~HLAVariableArrayDataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAVariableArrayDataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAVariableArrayDataType::decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const
|
||||||
|
{
|
||||||
|
stream.alignOffsetForSize(getAlignment());
|
||||||
|
HLATemplateDecodeVisitor<unsigned> numElementsVisitor(stream);
|
||||||
|
getSizeDataType()->accept(numElementsVisitor);
|
||||||
|
unsigned numElements = numElementsVisitor.getValue();
|
||||||
|
if (!value.setNumElements(numElements))
|
||||||
|
return false;
|
||||||
|
for (unsigned i = 0; i < numElements; ++i)
|
||||||
|
if (!value.decodeElement(stream, i))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAVariableArrayDataType::encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const
|
||||||
|
{
|
||||||
|
stream.alignOffsetForSize(getAlignment());
|
||||||
|
unsigned numElements = value.getNumElements();
|
||||||
|
HLATemplateEncodeVisitor<unsigned> numElementsVisitor(stream, numElements);
|
||||||
|
getSizeDataType()->accept(numElementsVisitor);
|
||||||
|
for (unsigned i = 0; i < numElements; ++i)
|
||||||
|
if (!value.encodeElement(stream, i))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAVariableArrayDataType::setSizeDataType(const HLADataType* sizeDataType)
|
||||||
|
{
|
||||||
|
// FIXME this only works if we do not reset the alignment to something smaller
|
||||||
|
if (getAlignment() < sizeDataType->getAlignment())
|
||||||
|
setAlignment(sizeDataType->getAlignment());
|
||||||
|
_sizeDataType = sizeDataType;
|
||||||
|
// setAlignment(SGMisc<unsigned>::max(_sizeDataType->getAlignment(), _elementDataType->getAlignment());
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,88 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLAArrayDataType_hxx
|
||||||
|
#define HLAArrayDataType_hxx
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
#include "HLADataType.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLAAbstractArrayDataElement;
|
||||||
|
|
||||||
|
class HLAArrayDataType : public HLADataType {
|
||||||
|
public:
|
||||||
|
HLAArrayDataType(const std::string& name = "HLAArrayDataType");
|
||||||
|
virtual ~HLAArrayDataType();
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
virtual const HLAArrayDataType* toArrayDataType() const;
|
||||||
|
|
||||||
|
virtual bool decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const = 0;
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const = 0;
|
||||||
|
|
||||||
|
void setElementDataType(const HLADataType* elementDataType);
|
||||||
|
const HLADataType* getElementDataType() const
|
||||||
|
{ return _elementDataType.get(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGSharedPtr<const HLADataType> _elementDataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAFixedArrayDataType : public HLAArrayDataType {
|
||||||
|
public:
|
||||||
|
HLAFixedArrayDataType(const std::string& name = "HLAFixedArrayDataType");
|
||||||
|
virtual ~HLAFixedArrayDataType();
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
virtual bool decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const;
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const;
|
||||||
|
|
||||||
|
void setNumElements(unsigned numElements)
|
||||||
|
{ _numElements = numElements; }
|
||||||
|
unsigned getNumElements() const
|
||||||
|
{ return _numElements; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned _numElements;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAVariableArrayDataType : public HLAArrayDataType {
|
||||||
|
public:
|
||||||
|
HLAVariableArrayDataType(const std::string& name = "HLAVariableArrayDataType");
|
||||||
|
virtual ~HLAVariableArrayDataType();
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
virtual bool decode(HLADecodeStream& stream, HLAAbstractArrayDataElement& value) const;
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, const HLAAbstractArrayDataElement& value) const;
|
||||||
|
|
||||||
|
void setSizeDataType(const HLADataType* sizeDataType);
|
||||||
|
const HLADataType* getSizeDataType() const
|
||||||
|
{ return _sizeDataType.get(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGSharedPtr<const HLADataType> _sizeDataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,132 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLABasicDataElement.hxx"
|
||||||
|
|
||||||
|
#include "HLADataTypeVisitor.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLABasicDataElement::HLABasicDataElement(const HLABasicDataType* dataType) :
|
||||||
|
_dataType(dataType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLABasicDataElement::~HLABasicDataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLABasicDataType*
|
||||||
|
HLABasicDataElement::getDataType() const
|
||||||
|
{
|
||||||
|
return _dataType.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLABasicDataElement::setDataType(const HLADataType* dataType)
|
||||||
|
{
|
||||||
|
const HLABasicDataType* scalarDataType = dynamic_cast<const HLABasicDataType*>(dataType);
|
||||||
|
if (!scalarDataType) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLABasicDataType: unable to set data type!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
setDataType(scalarDataType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLABasicDataElement::setDataType(const HLABasicDataType* dataType)
|
||||||
|
{
|
||||||
|
_dataType = dataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
#define IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(type, ctype) \
|
||||||
|
HLAAbstract##type##DataElement::HLAAbstract##type##DataElement(const HLABasicDataType* dataType) :\
|
||||||
|
HLABasicDataElement(dataType) \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLAAbstract##type##DataElement::~HLAAbstract##type##DataElement() \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
bool \
|
||||||
|
HLAAbstract##type##DataElement::encode(HLAEncodeStream& stream) const \
|
||||||
|
{ \
|
||||||
|
if (!_dataType.valid()) \
|
||||||
|
return false; \
|
||||||
|
HLATemplateEncodeVisitor<ctype> visitor(stream, getValue()); \
|
||||||
|
_dataType->accept(visitor); \
|
||||||
|
return true; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
bool \
|
||||||
|
HLAAbstract##type##DataElement::decode(HLADecodeStream& stream) \
|
||||||
|
{ \
|
||||||
|
if (!_dataType.valid()) \
|
||||||
|
return false; \
|
||||||
|
HLATemplateDecodeVisitor<ctype> visitor(stream); \
|
||||||
|
_dataType->accept(visitor); \
|
||||||
|
setValue(visitor.getValue()); \
|
||||||
|
return true; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLA##type##DataElement::HLA##type##DataElement(const HLABasicDataType* dataType) : \
|
||||||
|
HLAAbstract##type##DataElement(dataType), \
|
||||||
|
_value(0) \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLA##type##DataElement::HLA##type##DataElement(const HLABasicDataType* dataType, \
|
||||||
|
const ctype& value) : \
|
||||||
|
HLAAbstract##type##DataElement(dataType), \
|
||||||
|
_value(value) \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLA##type##DataElement::~HLA##type##DataElement() \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
ctype \
|
||||||
|
HLA##type##DataElement::getValue() const \
|
||||||
|
{ \
|
||||||
|
return _value; \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void \
|
||||||
|
HLA##type##DataElement::setValue(ctype value) \
|
||||||
|
{ \
|
||||||
|
_value = value; \
|
||||||
|
}
|
||||||
|
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(Char, char);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(WChar, wchar_t);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(SChar, signed char);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(UChar, unsigned char);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(Short, short);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(UShort, unsigned short);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(Int, int);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(UInt, unsigned int);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(Long, long);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(ULong, unsigned long);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(Float, float);
|
||||||
|
IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT(Double, double);
|
||||||
|
|
||||||
|
#undef IMPLEMENT_TYPED_HLA_BASIC_DATA_ELEMENT
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,108 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLABasicDataElement_hxx
|
||||||
|
#define HLABasicDataElement_hxx
|
||||||
|
|
||||||
|
#include "HLABasicDataType.hxx"
|
||||||
|
#include "HLADataElement.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLABasicDataElement : public HLADataElement {
|
||||||
|
public:
|
||||||
|
HLABasicDataElement(const HLABasicDataType* dataType);
|
||||||
|
virtual ~HLABasicDataElement();
|
||||||
|
|
||||||
|
virtual const HLABasicDataType* getDataType() const;
|
||||||
|
virtual bool setDataType(const HLADataType* dataType);
|
||||||
|
void setDataType(const HLABasicDataType* dataType);
|
||||||
|
|
||||||
|
protected:
|
||||||
|
SGSharedPtr<const HLABasicDataType> _dataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
#define TYPED_HLA_BASIC_DATA_ELEMENT(type, ctype) \
|
||||||
|
class HLAAbstract##type##DataElement : public HLABasicDataElement { \
|
||||||
|
public: \
|
||||||
|
HLAAbstract##type##DataElement(const HLABasicDataType* dataType = 0); \
|
||||||
|
virtual ~HLAAbstract##type##DataElement(); \
|
||||||
|
virtual bool encode(HLAEncodeStream& stream) const; \
|
||||||
|
virtual bool decode(HLADecodeStream& stream); \
|
||||||
|
\
|
||||||
|
virtual ctype getValue() const = 0; \
|
||||||
|
virtual void setValue(ctype) = 0; \
|
||||||
|
}; \
|
||||||
|
class HLA##type##DataElement : public HLAAbstract##type##DataElement { \
|
||||||
|
public: \
|
||||||
|
HLA##type##DataElement(const HLABasicDataType* dataType = 0); \
|
||||||
|
HLA##type##DataElement(const HLABasicDataType* dataType, \
|
||||||
|
const ctype& value); \
|
||||||
|
virtual ~HLA##type##DataElement(); \
|
||||||
|
virtual ctype getValue() const; \
|
||||||
|
virtual void setValue(ctype value); \
|
||||||
|
private: \
|
||||||
|
ctype _value; \
|
||||||
|
}; \
|
||||||
|
class HLA##type##Data { \
|
||||||
|
public: \
|
||||||
|
HLA##type##Data() : \
|
||||||
|
_value(new HLA##type##DataElement(0)) \
|
||||||
|
{ } \
|
||||||
|
HLA##type##Data(const ctype& value) : \
|
||||||
|
_value(new HLA##type##DataElement(0, value)) \
|
||||||
|
{ } \
|
||||||
|
operator ctype() const \
|
||||||
|
{ return _value->getValue(); } \
|
||||||
|
HLA##type##Data& operator=(const ctype& value) \
|
||||||
|
{ _value->setValue(value); return *this; } \
|
||||||
|
ctype getValue() const \
|
||||||
|
{ return _value->getValue(); } \
|
||||||
|
void setValue(const ctype& value) \
|
||||||
|
{ _value->setValue(value); } \
|
||||||
|
const HLA##type##DataElement* getDataElement() const \
|
||||||
|
{ return _value.get(); } \
|
||||||
|
HLA##type##DataElement* getDataElement() \
|
||||||
|
{ return _value.get(); } \
|
||||||
|
const HLABasicDataType* getDataType() const \
|
||||||
|
{ return _value->getDataType(); } \
|
||||||
|
void setDataType(const HLABasicDataType* dataType) \
|
||||||
|
{ _value->setDataType(dataType); } \
|
||||||
|
\
|
||||||
|
private: \
|
||||||
|
SGSharedPtr<HLA##type##DataElement> _value; \
|
||||||
|
};
|
||||||
|
|
||||||
|
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(Char, char);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(WChar, wchar_t);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(SChar, signed char);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(UChar, unsigned char);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(Short, short);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(UShort, unsigned short);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(Int, int);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(UInt, unsigned int);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(Long, long);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(ULong, unsigned long);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(Float, float);
|
||||||
|
TYPED_HLA_BASIC_DATA_ELEMENT(Double, double);
|
||||||
|
|
||||||
|
#undef TYPED_HLA_BASIC_DATA_ELEMENT
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,170 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLABasicDataType.hxx"
|
||||||
|
|
||||||
|
#include "HLADataType.hxx"
|
||||||
|
#include "HLADataTypeVisitor.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLABasicDataType::HLABasicDataType(const std::string& name) :
|
||||||
|
HLADataType(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLABasicDataType::~HLABasicDataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLABasicDataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLABasicDataType*
|
||||||
|
HLABasicDataType::toBasicDataType() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HLAInt8DataType::HLAInt8DataType(const std::string& name) :
|
||||||
|
HLABasicDataType(name)
|
||||||
|
{
|
||||||
|
setAlignment(sizeof(int8_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAInt8DataType::~HLAInt8DataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAInt8DataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
HLAUInt8DataType::HLAUInt8DataType(const std::string& name) :
|
||||||
|
HLABasicDataType(name)
|
||||||
|
{
|
||||||
|
setAlignment(sizeof(uint8_t));
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAUInt8DataType::~HLAUInt8DataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAUInt8DataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
//////////////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
|
#define BASIC_DATATYPE_IMPLEMENTATION(type, name) \
|
||||||
|
HLA##name##DataType::HLA##name##DataType(const std::string& name) : \
|
||||||
|
HLABasicDataType(name) \
|
||||||
|
{ \
|
||||||
|
setAlignment(sizeof(type)); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLA##name##DataType::~HLA##name##DataType() \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
void \
|
||||||
|
HLA##name##DataType::accept(HLADataTypeVisitor& visitor) const \
|
||||||
|
{ \
|
||||||
|
visitor.apply(*this); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
HLA##name##LEDataType::HLA##name##LEDataType(const std::string& name) : \
|
||||||
|
HLA##name##DataType(name) \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLA##name##LEDataType::~HLA##name##LEDataType() \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
bool \
|
||||||
|
HLA##name##LEDataType::decode(HLADecodeStream& stream, \
|
||||||
|
type& value) const \
|
||||||
|
{ \
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment())) \
|
||||||
|
return false; \
|
||||||
|
return stream.decode##name##LE(value); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
bool \
|
||||||
|
HLA##name##LEDataType::encode(HLAEncodeStream& stream, \
|
||||||
|
const type& value) const \
|
||||||
|
{ \
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment())) \
|
||||||
|
return false; \
|
||||||
|
return stream.encode##name##LE(value); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
\
|
||||||
|
\
|
||||||
|
HLA##name##BEDataType::HLA##name##BEDataType(const std::string& name) : \
|
||||||
|
HLA##name##DataType(name) \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
HLA##name##BEDataType::~HLA##name##BEDataType() \
|
||||||
|
{ \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
bool \
|
||||||
|
HLA##name##BEDataType::decode(HLADecodeStream& stream, \
|
||||||
|
type& value) const \
|
||||||
|
{ \
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment())) \
|
||||||
|
return false; \
|
||||||
|
return stream.decode##name##BE(value); \
|
||||||
|
} \
|
||||||
|
\
|
||||||
|
bool \
|
||||||
|
HLA##name##BEDataType::encode(HLAEncodeStream& stream, \
|
||||||
|
const type& value) const \
|
||||||
|
{ \
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment())) \
|
||||||
|
return false; \
|
||||||
|
return stream.encode##name##BE(value); \
|
||||||
|
}
|
||||||
|
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(int16_t, Int16)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(uint16_t, UInt16)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(int32_t, Int32)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(uint32_t, UInt32)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(int64_t, Int64)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(uint64_t, UInt64)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(float, Float32)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(double, Float64)
|
||||||
|
|
||||||
|
#undef BASIC_DATATYPE_IMPLEMENTATION
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
@@ -0,0 +1,155 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLABasicDataType_hxx
|
||||||
|
#define HLABasicDataType_hxx
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include "HLADataType.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLABasicDataType : public HLADataType {
|
||||||
|
public:
|
||||||
|
virtual ~HLABasicDataType();
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
virtual const HLABasicDataType* toBasicDataType() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
HLABasicDataType(const std::string& name);
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAInt8DataType : public HLABasicDataType {
|
||||||
|
public:
|
||||||
|
HLAInt8DataType(const std::string& name = "HLAInt8DataType");
|
||||||
|
virtual ~HLAInt8DataType();
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
bool skip(HLADecodeStream& stream) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.skip(1);
|
||||||
|
}
|
||||||
|
bool skip(HLAEncodeStream& stream) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.skip(1);
|
||||||
|
}
|
||||||
|
bool decode(HLADecodeStream& stream, int8_t& value) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.decodeInt8(value);
|
||||||
|
}
|
||||||
|
bool encode(HLAEncodeStream& stream, const int8_t& value) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.encodeInt8(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAUInt8DataType : public HLABasicDataType {
|
||||||
|
public:
|
||||||
|
HLAUInt8DataType(const std::string& name = "HLAUInt8DataType");
|
||||||
|
virtual ~HLAUInt8DataType();
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
bool skip(HLADecodeStream& stream) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.skip(1);
|
||||||
|
}
|
||||||
|
bool skip(HLAEncodeStream& stream) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.skip(1);
|
||||||
|
}
|
||||||
|
bool decode(HLADecodeStream& stream, uint8_t& value) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.decodeUInt8(value);
|
||||||
|
}
|
||||||
|
bool encode(HLAEncodeStream& stream, const uint8_t& value) const
|
||||||
|
{
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment()))
|
||||||
|
return false;
|
||||||
|
return stream.encodeUInt8(value);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
#define BASIC_DATATYPE_IMPLEMENTATION(type, name) \
|
||||||
|
class HLA##name##DataType : public HLABasicDataType { \
|
||||||
|
public: \
|
||||||
|
virtual ~HLA##name##DataType(); \
|
||||||
|
\
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const; \
|
||||||
|
\
|
||||||
|
bool skip(HLADecodeStream& stream) const \
|
||||||
|
{ \
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment())) \
|
||||||
|
return false; \
|
||||||
|
return stream.skip(sizeof(type)); \
|
||||||
|
} \
|
||||||
|
bool skip(HLAEncodeStream& stream) const \
|
||||||
|
{ \
|
||||||
|
if (!stream.alignOffsetForSize(getAlignment())) \
|
||||||
|
return false; \
|
||||||
|
return stream.skip(sizeof(type)); \
|
||||||
|
} \
|
||||||
|
virtual bool decode(HLADecodeStream& stream, type& value) const = 0; \
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, const type& value) const = 0;\
|
||||||
|
protected: \
|
||||||
|
HLA##name##DataType(const std::string& name); \
|
||||||
|
}; \
|
||||||
|
class HLA##name##LEDataType : public HLA##name##DataType { \
|
||||||
|
public: \
|
||||||
|
HLA##name##LEDataType(const std::string& name = "HLA" #name "LEDataType");\
|
||||||
|
virtual ~HLA##name##LEDataType(); \
|
||||||
|
virtual bool decode(HLADecodeStream& stream, type& value) const; \
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, const type& value) const; \
|
||||||
|
}; \
|
||||||
|
class HLA##name##BEDataType : public HLA##name##DataType { \
|
||||||
|
public: \
|
||||||
|
HLA##name##BEDataType(const std::string& name = "HLA" #name "BEDataType");\
|
||||||
|
virtual ~HLA##name##BEDataType(); \
|
||||||
|
virtual bool decode(HLADecodeStream& stream, type& value) const; \
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, const type& value) const; \
|
||||||
|
};
|
||||||
|
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(int16_t, Int16)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(uint16_t, UInt16)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(int32_t, Int32)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(uint32_t, UInt32)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(int64_t, Int64)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(uint64_t, UInt64)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(float, Float32)
|
||||||
|
BASIC_DATATYPE_IMPLEMENTATION(double, Float64)
|
||||||
|
|
||||||
|
#undef BASIC_DATATYPE_IMPLEMENTATION
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,187 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLADataElement.hxx"
|
||||||
|
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLADataElement::PathElement::Data::~Data()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataElement::PathElement::FieldData*
|
||||||
|
HLADataElement::PathElement::Data::toFieldData() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataElement::PathElement::IndexData*
|
||||||
|
HLADataElement::PathElement::Data::toIndexData() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement::PathElement::FieldData::FieldData(const std::string& name) :
|
||||||
|
_name(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement::PathElement::FieldData::~FieldData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataElement::PathElement::FieldData*
|
||||||
|
HLADataElement::PathElement::FieldData::toFieldData() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLADataElement::PathElement::FieldData::less(const Data* data) const
|
||||||
|
{
|
||||||
|
const FieldData* fieldData = data->toFieldData();
|
||||||
|
// IndexData is allways smaller than FieldData
|
||||||
|
if (!fieldData)
|
||||||
|
return false;
|
||||||
|
return _name < fieldData->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLADataElement::PathElement::FieldData::equal(const Data* data) const
|
||||||
|
{
|
||||||
|
const FieldData* fieldData = data->toFieldData();
|
||||||
|
// IndexData is allways smaller than FieldData
|
||||||
|
if (!fieldData)
|
||||||
|
return false;
|
||||||
|
return _name == fieldData->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLADataElement::PathElement::FieldData::append(std::string& s) const
|
||||||
|
{
|
||||||
|
s.append(1, std::string::value_type('.'));
|
||||||
|
s.append(_name);
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement::PathElement::IndexData::IndexData(unsigned index) :
|
||||||
|
_index(index)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement::PathElement::IndexData::~IndexData()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataElement::PathElement::IndexData*
|
||||||
|
HLADataElement::PathElement::IndexData::toIndexData() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLADataElement::PathElement::IndexData::less(const Data* data) const
|
||||||
|
{
|
||||||
|
const IndexData* indexData = data->toIndexData();
|
||||||
|
// IndexData is allways smaller than FieldData
|
||||||
|
if (!indexData)
|
||||||
|
return true;
|
||||||
|
return _index < indexData->_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLADataElement::PathElement::IndexData::equal(const Data* data) const
|
||||||
|
{
|
||||||
|
const IndexData* indexData = data->toIndexData();
|
||||||
|
// IndexData is allways smaller than FieldData
|
||||||
|
if (!indexData)
|
||||||
|
return false;
|
||||||
|
return _index == indexData->_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLADataElement::PathElement::IndexData::append(std::string& s) const
|
||||||
|
{
|
||||||
|
s.append(1, std::string::value_type('['));
|
||||||
|
unsigned value = _index;
|
||||||
|
do {
|
||||||
|
s.append(1, std::string::value_type('0' + value % 10));
|
||||||
|
} while (value /= 10);
|
||||||
|
s.append(1, std::string::value_type(']'));
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement::~HLADataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
HLADataElement::toString(const Path& path)
|
||||||
|
{
|
||||||
|
std::string s;
|
||||||
|
for (Path::const_iterator i = path.begin(); i != path.end(); ++i)
|
||||||
|
i->append(s);
|
||||||
|
return s;
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataElement::AttributePathPair
|
||||||
|
HLADataElement::toAttributePathPair(const std::string& s)
|
||||||
|
{
|
||||||
|
Path path;
|
||||||
|
// Skip the initial attribute name if given
|
||||||
|
std::string::size_type i = s.find_first_of("[.");
|
||||||
|
std::string attribute = s.substr(0, i);
|
||||||
|
while (i < s.size()) {
|
||||||
|
if (s[i] == '[') {
|
||||||
|
++i;
|
||||||
|
unsigned index = 0;
|
||||||
|
while (i < s.size()) {
|
||||||
|
if (s[i] == ']')
|
||||||
|
break;
|
||||||
|
unsigned v = s[i] - '0';
|
||||||
|
// Error, no number
|
||||||
|
if (10 <= v) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLADataElement: invalid character in array subscript for \""
|
||||||
|
<< s << "\" at \"" << attribute << toString(path) << "\"!");
|
||||||
|
return AttributePathPair();
|
||||||
|
}
|
||||||
|
index *= 10;
|
||||||
|
index += v;
|
||||||
|
++i;
|
||||||
|
}
|
||||||
|
path.push_back(index);
|
||||||
|
++i;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
if (s[i] == '.') {
|
||||||
|
// Error, . cannot be last
|
||||||
|
if (s.size() <= ++i) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLADataElement: invalid terminating '.' for \""
|
||||||
|
<< s << "\"!");
|
||||||
|
return AttributePathPair();
|
||||||
|
}
|
||||||
|
std::string::size_type e = s.find_first_of("[.", i);
|
||||||
|
path.push_back(s.substr(i, e - i));
|
||||||
|
i = e;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return AttributePathPair(attribute, path);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,217 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLADataElement_hxx
|
||||||
|
#define HLADataElement_hxx
|
||||||
|
|
||||||
|
#include <list>
|
||||||
|
#include <map>
|
||||||
|
#include <simgear/structure/SGReferenced.hxx>
|
||||||
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
#include <simgear/timing/timestamp.hxx>
|
||||||
|
#include "RTIData.hxx"
|
||||||
|
#include "HLADataType.hxx"
|
||||||
|
|
||||||
|
class SGTimeStamp;
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLADataElement : public SGReferenced {
|
||||||
|
public:
|
||||||
|
virtual ~HLADataElement();
|
||||||
|
|
||||||
|
virtual bool encode(HLAEncodeStream& stream) const = 0;
|
||||||
|
virtual bool decode(HLADecodeStream& stream) = 0;
|
||||||
|
|
||||||
|
virtual const HLADataType* getDataType() const = 0;
|
||||||
|
virtual bool setDataType(const HLADataType* dataType) = 0;
|
||||||
|
|
||||||
|
// Container for the timestamp the originating attribute was last updated for
|
||||||
|
// class TimeStamp : public SGReferenced {
|
||||||
|
// public:
|
||||||
|
// const SGTimeStamp& getTimeStamp() const
|
||||||
|
// { return _timeStamp; }
|
||||||
|
// void setTimeStamp(const SGTimeStamp& timeStamp)
|
||||||
|
// { _timeStamp = timeStamp; }
|
||||||
|
// private:
|
||||||
|
// SGTimeStamp _timeStamp;
|
||||||
|
// };
|
||||||
|
|
||||||
|
// const TimeStamp* getTimeStamp() const
|
||||||
|
// { return _timeStamp.get(); }
|
||||||
|
// void setTimeStamp(const TimeStamp* timeStamp)
|
||||||
|
// { _timeStamp = timeStamp; }
|
||||||
|
|
||||||
|
// struct ChangeCount : public SGReferenced {
|
||||||
|
// ChangeCount() : _value(0) {}
|
||||||
|
// unsigned _value;
|
||||||
|
// };
|
||||||
|
// SGSharedPtr<ChangeCount> _changeCount;
|
||||||
|
// unsigned getChangeCount() const
|
||||||
|
// {
|
||||||
|
// // If we don't have return allways the same
|
||||||
|
// if (!_changeCount.valid())
|
||||||
|
// return 0;
|
||||||
|
// return _changeCount->_value;
|
||||||
|
// }
|
||||||
|
|
||||||
|
/// HLADataElements could be identified by path
|
||||||
|
/// These paths are composed of structure field names and array indices in the
|
||||||
|
/// order they appear while walking to the data element.
|
||||||
|
/// So provide here some tool functions to access these elements
|
||||||
|
/// Note that these functions are relatively expensive in execution time.
|
||||||
|
/// So only use them once at object creation time and store direct references to the values
|
||||||
|
|
||||||
|
class PathElement {
|
||||||
|
public:
|
||||||
|
PathElement(unsigned index) : _data(new IndexData(index)) {}
|
||||||
|
PathElement(const std::string& name) : _data(new FieldData(name)) {}
|
||||||
|
|
||||||
|
bool isFieldValue() const
|
||||||
|
{ return _data->toFieldData(); }
|
||||||
|
bool isIndexValue() const
|
||||||
|
{ return _data->toIndexData(); }
|
||||||
|
|
||||||
|
unsigned getIndexValue() const
|
||||||
|
{
|
||||||
|
const IndexData* indexData = _data->toIndexData();
|
||||||
|
if (!indexData)
|
||||||
|
return ~unsigned(0);
|
||||||
|
return indexData->_index;
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string getFieldValue() const
|
||||||
|
{
|
||||||
|
const FieldData* fieldData = _data->toFieldData();
|
||||||
|
if (!fieldData)
|
||||||
|
return std::string();
|
||||||
|
return fieldData->_name;
|
||||||
|
}
|
||||||
|
|
||||||
|
// Want to be able to use that in std::map and std::set
|
||||||
|
bool operator<(const PathElement& pathElement) const
|
||||||
|
{ return _data->less(pathElement._data.get()); }
|
||||||
|
bool operator==(const PathElement& pathElement) const
|
||||||
|
{ return _data->equal(pathElement._data.get()); }
|
||||||
|
|
||||||
|
void append(std::string& s) const
|
||||||
|
{ _data->append(s); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
struct FieldData;
|
||||||
|
struct IndexData;
|
||||||
|
struct Data : public SGReferenced {
|
||||||
|
virtual ~Data();
|
||||||
|
virtual const FieldData* toFieldData() const;
|
||||||
|
virtual const IndexData* toIndexData() const;
|
||||||
|
virtual bool less(const Data*) const = 0;
|
||||||
|
virtual bool equal(const Data*) const = 0;
|
||||||
|
virtual void append(std::string&) const = 0;
|
||||||
|
};
|
||||||
|
struct FieldData : public Data {
|
||||||
|
FieldData(const std::string& name);
|
||||||
|
virtual ~FieldData();
|
||||||
|
virtual const FieldData* toFieldData() const;
|
||||||
|
virtual bool less(const Data* data) const;
|
||||||
|
virtual bool equal(const Data* data) const;
|
||||||
|
virtual void append(std::string& s) const;
|
||||||
|
std::string _name;
|
||||||
|
};
|
||||||
|
struct IndexData : public Data {
|
||||||
|
IndexData(unsigned index);
|
||||||
|
virtual ~IndexData();
|
||||||
|
virtual const IndexData* toIndexData() const;
|
||||||
|
virtual bool less(const Data* data) const;
|
||||||
|
virtual bool equal(const Data* data) const;
|
||||||
|
virtual void append(std::string& s) const;
|
||||||
|
unsigned _index;
|
||||||
|
};
|
||||||
|
|
||||||
|
SGSharedPtr<Data> _data;
|
||||||
|
};
|
||||||
|
typedef std::list<PathElement> Path;
|
||||||
|
typedef std::pair<std::string, Path> AttributePathPair;
|
||||||
|
typedef std::pair<unsigned, Path> IndexPathPair;
|
||||||
|
|
||||||
|
static std::string toString(const Path& path);
|
||||||
|
static std::string toString(const AttributePathPair& path)
|
||||||
|
{ return path.first + toString(path.second); }
|
||||||
|
static AttributePathPair toAttributePathPair(const std::string& s);
|
||||||
|
static Path toPath(const std::string& s)
|
||||||
|
{ return toAttributePathPair(s).second; }
|
||||||
|
|
||||||
|
private:
|
||||||
|
// SGSharedPtr<const TimeStamp> _timeStamp;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLADataElementProvider {
|
||||||
|
public:
|
||||||
|
class AbstractProvider : public SGReferenced {
|
||||||
|
public:
|
||||||
|
virtual ~AbstractProvider() { }
|
||||||
|
virtual HLADataElement* getDataElement(const HLADataElement::Path& path) = 0;
|
||||||
|
// virtual HLADataElement* getDataElement(const HLADataElement::Path& path, const HLADataType* dataType)
|
||||||
|
// {
|
||||||
|
// SGSharedPtr<HLADataElement> dataElement = getDataElement(path);
|
||||||
|
// if (!dataElement.valid())
|
||||||
|
// return 0;
|
||||||
|
// if (!dataElement->setDataType(dataType))
|
||||||
|
// return 0;
|
||||||
|
// return dataElement.release();
|
||||||
|
// }
|
||||||
|
};
|
||||||
|
|
||||||
|
HLADataElementProvider()
|
||||||
|
{ }
|
||||||
|
HLADataElementProvider(HLADataElement* dataElement) :
|
||||||
|
_provider(new ConcreteProvider(dataElement))
|
||||||
|
{ }
|
||||||
|
HLADataElementProvider(const SGSharedPtr<HLADataElement>& dataElement) :
|
||||||
|
_provider(new ConcreteProvider(dataElement))
|
||||||
|
{ }
|
||||||
|
HLADataElementProvider(AbstractProvider* provider) :
|
||||||
|
_provider(provider)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
HLADataElement* getDataElement(const HLADataElement::Path& path) const
|
||||||
|
{
|
||||||
|
if (!_provider.valid())
|
||||||
|
return 0;
|
||||||
|
return _provider->getDataElement(path);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
class ConcreteProvider : public AbstractProvider {
|
||||||
|
public:
|
||||||
|
ConcreteProvider(const SGSharedPtr<HLADataElement>& dataElement) :
|
||||||
|
_dataElement(dataElement)
|
||||||
|
{ }
|
||||||
|
virtual HLADataElement* getDataElement(const HLADataElement::Path&)
|
||||||
|
{ return _dataElement.get(); }
|
||||||
|
private:
|
||||||
|
SGSharedPtr<HLADataElement> _dataElement;
|
||||||
|
};
|
||||||
|
|
||||||
|
SGSharedPtr<AbstractProvider> _provider;
|
||||||
|
};
|
||||||
|
|
||||||
|
typedef std::map<HLADataElement::Path, HLADataElementProvider> HLAPathElementMap;
|
||||||
|
typedef std::map<unsigned, HLAPathElementMap> HLAAttributePathElementMap;
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,104 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLADataType.hxx"
|
||||||
|
|
||||||
|
#include "HLADataElement.hxx"
|
||||||
|
#include "HLADataTypeVisitor.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLADataType::HLADataType(const std::string& name, unsigned alignment) :
|
||||||
|
_name(name),
|
||||||
|
_alignment(1)
|
||||||
|
{
|
||||||
|
setAlignment(alignment);
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataType::~HLADataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLADataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataTypeReference*
|
||||||
|
HLADataType::toDataTypeReference() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLABasicDataType*
|
||||||
|
HLADataType::toBasicDataType() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAArrayDataType*
|
||||||
|
HLADataType::toArrayDataType() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAEnumeratedDataType*
|
||||||
|
HLADataType::toEnumeratedDataType() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAFixedRecordDataType*
|
||||||
|
HLADataType::toFixedRecordDataType() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAVariantDataType*
|
||||||
|
HLADataType::toVariantDataType() const
|
||||||
|
{
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLADataType::setAlignment(unsigned alignment)
|
||||||
|
{
|
||||||
|
/// FIXME: more checks
|
||||||
|
if (alignment == 0)
|
||||||
|
_alignment = 1;
|
||||||
|
else
|
||||||
|
_alignment = alignment;
|
||||||
|
}
|
||||||
|
|
||||||
|
HLADataTypeReference::~HLADataTypeReference()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLADataTypeReference::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLADataTypeReference*
|
||||||
|
HLADataTypeReference::toDataTypeReference() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,99 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLADataType_hxx
|
||||||
|
#define HLADataType_hxx
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <simgear/structure/SGWeakPtr.hxx>
|
||||||
|
#include <simgear/structure/SGWeakReferenced.hxx>
|
||||||
|
#include "RTIData.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLADataTypeVisitor;
|
||||||
|
|
||||||
|
class HLADataTypeReference;
|
||||||
|
class HLABasicDataType;
|
||||||
|
class HLAArrayDataType;
|
||||||
|
class HLAEnumeratedDataType;
|
||||||
|
class HLAFixedRecordDataType;
|
||||||
|
class HLAVariantDataType;
|
||||||
|
|
||||||
|
enum HLAUpdateType {
|
||||||
|
HLAStaticUpdate,
|
||||||
|
HLAPeriodicUpdate,
|
||||||
|
HLAConditionalUpdate,
|
||||||
|
HLAUndefinedUpdate
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLADataType : public SGWeakReferenced {
|
||||||
|
public:
|
||||||
|
virtual ~HLADataType();
|
||||||
|
|
||||||
|
const std::string& getName() const
|
||||||
|
{ return _name; }
|
||||||
|
|
||||||
|
const std::string& getSemantics() const
|
||||||
|
{ return _semantics; }
|
||||||
|
void setSemantics(const std::string& semantics)
|
||||||
|
{ _semantics = semantics; }
|
||||||
|
|
||||||
|
unsigned getAlignment() const
|
||||||
|
{ return _alignment; }
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
virtual const HLADataTypeReference* toDataTypeReference() const;
|
||||||
|
virtual const HLABasicDataType* toBasicDataType() const;
|
||||||
|
virtual const HLAArrayDataType* toArrayDataType() const;
|
||||||
|
virtual const HLAEnumeratedDataType* toEnumeratedDataType() const;
|
||||||
|
virtual const HLAFixedRecordDataType* toFixedRecordDataType() const;
|
||||||
|
virtual const HLAVariantDataType* toVariantDataType() const;
|
||||||
|
|
||||||
|
protected:
|
||||||
|
HLADataType(const std::string& name, unsigned alignment = 1);
|
||||||
|
void setAlignment(unsigned alignment);
|
||||||
|
|
||||||
|
private:
|
||||||
|
std::string _name;
|
||||||
|
std::string _semantics;
|
||||||
|
unsigned _alignment;
|
||||||
|
};
|
||||||
|
|
||||||
|
// Weak reference to a data type. Used to implement self referencing data types
|
||||||
|
class HLADataTypeReference : public HLADataType {
|
||||||
|
public:
|
||||||
|
HLADataTypeReference(const SGSharedPtr<HLADataType>& dataType) :
|
||||||
|
HLADataType(dataType->getName(), dataType->getAlignment()),
|
||||||
|
_dataType(dataType)
|
||||||
|
{ }
|
||||||
|
virtual ~HLADataTypeReference();
|
||||||
|
|
||||||
|
SGSharedPtr<const HLADataType> getDataType() const
|
||||||
|
{ return _dataType.lock(); }
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
virtual const HLADataTypeReference* toDataTypeReference() const;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGWeakPtr<const HLADataType> _dataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,634 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLADataTypeVisitor_hxx
|
||||||
|
#define HLADataTypeVisitor_hxx
|
||||||
|
|
||||||
|
#include <cassert>
|
||||||
|
#include <string>
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
#include <simgear/math/SGMath.hxx>
|
||||||
|
#include "HLAArrayDataType.hxx"
|
||||||
|
#include "HLABasicDataType.hxx"
|
||||||
|
#include "HLADataTypeVisitor.hxx"
|
||||||
|
#include "HLAEnumeratedDataType.hxx"
|
||||||
|
#include "HLAFixedRecordDataType.hxx"
|
||||||
|
#include "HLAVariantDataType.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLADataTypeVisitor {
|
||||||
|
public:
|
||||||
|
virtual ~HLADataTypeVisitor() {}
|
||||||
|
|
||||||
|
virtual void apply(const HLADataType& dataType)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void apply(const HLADataTypeReference& dataType)
|
||||||
|
{
|
||||||
|
SGSharedPtr<const HLADataType> dataTypeReference = dataType.getDataType();
|
||||||
|
if (!dataTypeReference.valid()) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLADataTypeReference weak reference vanished!");
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
dataTypeReference->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLABasicDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLADataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType)
|
||||||
|
{ apply(static_cast<const HLABasicDataType&>(dataType)); }
|
||||||
|
|
||||||
|
virtual void apply(const HLAArrayDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLADataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLAArrayDataType&>(dataType)); }
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLAArrayDataType&>(dataType)); }
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLADataType&>(dataType)); }
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedRecordDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLADataType&>(dataType)); }
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType)
|
||||||
|
{ apply(static_cast<const HLADataType&>(dataType)); }
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Walks the datatype tree and checks if it is completely defined
|
||||||
|
class HLADataTypeCheckVisitor : public HLADataTypeVisitor {
|
||||||
|
public:
|
||||||
|
HLADataTypeCheckVisitor() : _valid(true) {}
|
||||||
|
|
||||||
|
bool valid() const { return _valid; }
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType) { }
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType) { }
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
if (!dataType.getElementDataType())
|
||||||
|
_valid = false;
|
||||||
|
else
|
||||||
|
dataType.getElementDataType()->accept(*this);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
if (!dataType.getElementDataType())
|
||||||
|
_valid = false;
|
||||||
|
else
|
||||||
|
dataType.getElementDataType()->accept(*this);
|
||||||
|
|
||||||
|
if (!dataType.getSizeDataType())
|
||||||
|
_valid = false;
|
||||||
|
else
|
||||||
|
dataType.getSizeDataType()->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
if (!dataType.getRepresentation())
|
||||||
|
_valid = false;
|
||||||
|
else
|
||||||
|
dataType.getRepresentation()->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedRecordDataType& dataType)
|
||||||
|
{
|
||||||
|
unsigned numFields = dataType.getNumFields();
|
||||||
|
for (unsigned i = 0; i < numFields; ++i) {
|
||||||
|
if (!dataType.getFieldDataType(i))
|
||||||
|
_valid = false;
|
||||||
|
else
|
||||||
|
dataType.getFieldDataType(i)->accept(*this);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType)
|
||||||
|
{ assert(0); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
bool _valid;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLADataTypeDecodeVisitor : public HLADataTypeVisitor {
|
||||||
|
public:
|
||||||
|
HLADataTypeDecodeVisitor(HLADecodeStream& stream) : _stream(stream) {}
|
||||||
|
virtual ~HLADataTypeDecodeVisitor() {}
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
unsigned numElements = dataType.getNumElements();
|
||||||
|
for (unsigned i = 0; i < numElements; ++i)
|
||||||
|
dataType.getElementDataType()->accept(*this);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType);
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.getRepresentation()->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedRecordDataType& dataType)
|
||||||
|
{
|
||||||
|
unsigned numFields = dataType.getNumFields();
|
||||||
|
for (unsigned i = 0; i < numFields; ++i)
|
||||||
|
dataType.getFieldDataType(i)->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType) { assert(0); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
HLADecodeStream& _stream;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLADataTypeEncodeVisitor : public HLADataTypeVisitor {
|
||||||
|
public:
|
||||||
|
HLADataTypeEncodeVisitor(HLAEncodeStream& stream) : _stream(stream) {}
|
||||||
|
virtual ~HLADataTypeEncodeVisitor() {}
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType) { dataType.skip(_stream); }
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
/// FIXME, might vanish in this sense ...
|
||||||
|
// dataType.encode(_stream, *this);
|
||||||
|
unsigned numElements = dataType.getNumElements();
|
||||||
|
for (unsigned i = 0; i < numElements; ++i)
|
||||||
|
dataType.getElementDataType()->accept(*this);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType);
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.getRepresentation()->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedRecordDataType& dataType)
|
||||||
|
{
|
||||||
|
unsigned numFields = dataType.getNumFields();
|
||||||
|
for (unsigned i = 0; i < numFields; ++i)
|
||||||
|
dataType.getFieldDataType(i)->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType) { assert(0); }
|
||||||
|
|
||||||
|
protected:
|
||||||
|
HLAEncodeStream& _stream;
|
||||||
|
};
|
||||||
|
|
||||||
|
/// Begin implementation of some get/set visitors
|
||||||
|
|
||||||
|
class HLAScalarDecodeVisitor : public HLADataTypeDecodeVisitor {
|
||||||
|
public:
|
||||||
|
HLAScalarDecodeVisitor(HLADecodeStream& stream) :
|
||||||
|
HLADataTypeDecodeVisitor(stream)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing scalar value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing scalar value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing scalar value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedRecordDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing scalar value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing scalar value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAScalarEncodeVisitor : public HLADataTypeEncodeVisitor {
|
||||||
|
public:
|
||||||
|
HLAScalarEncodeVisitor(HLAEncodeStream& stream) :
|
||||||
|
HLADataTypeEncodeVisitor(stream)
|
||||||
|
{}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing scalar value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing scalar value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing scalar value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedRecordDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing scalar value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing scalar value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAFixedRecordDecodeVisitor : public HLADataTypeDecodeVisitor {
|
||||||
|
public:
|
||||||
|
HLAFixedRecordDecodeVisitor(HLADecodeStream& stream) :
|
||||||
|
HLADataTypeDecodeVisitor(stream)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while decodeing a fixed record value");
|
||||||
|
HLADataTypeDecodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAFixedRecordEncodeVisitor : public HLADataTypeEncodeVisitor {
|
||||||
|
public:
|
||||||
|
HLAFixedRecordEncodeVisitor(HLAEncodeStream& stream) :
|
||||||
|
HLADataTypeEncodeVisitor(stream)
|
||||||
|
{ }
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAFixedArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAEnumeratedDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
|
||||||
|
virtual void apply(const HLAVariantDataType& dataType)
|
||||||
|
{
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "Unexpected HLADataType while writing a fixed record value");
|
||||||
|
HLADataTypeEncodeVisitor::apply(dataType);
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class HLATemplateDecodeVisitor : public HLAScalarDecodeVisitor {
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
|
||||||
|
HLATemplateDecodeVisitor(HLADecodeStream& stream, const value_type& value = value_type()) :
|
||||||
|
HLAScalarDecodeVisitor(stream),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void setValue(const value_type& value)
|
||||||
|
{ _value = value; }
|
||||||
|
const value_type& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
int8_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
uint8_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
int16_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
uint16_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
int32_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
uint32_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
int64_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
uint64_t value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType)
|
||||||
|
{
|
||||||
|
float value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType)
|
||||||
|
{
|
||||||
|
double value = 0;
|
||||||
|
dataType.decode(_stream, value);
|
||||||
|
_value = value_type(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
value_type _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename T>
|
||||||
|
class HLATemplateEncodeVisitor : public HLAScalarEncodeVisitor {
|
||||||
|
public:
|
||||||
|
typedef T value_type;
|
||||||
|
|
||||||
|
HLATemplateEncodeVisitor(HLAEncodeStream& stream, const value_type& value = value_type()) :
|
||||||
|
HLAScalarEncodeVisitor(stream),
|
||||||
|
_value(value)
|
||||||
|
{}
|
||||||
|
|
||||||
|
void setValue(const value_type& value)
|
||||||
|
{ _value = value; }
|
||||||
|
const value_type& getValue() const
|
||||||
|
{ return _value; }
|
||||||
|
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat32DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
virtual void apply(const HLAFloat64DataType& dataType)
|
||||||
|
{
|
||||||
|
dataType.encode(_stream, _value);
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
value_type _value;
|
||||||
|
};
|
||||||
|
|
||||||
|
inline void HLADataTypeDecodeVisitor::apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
HLATemplateDecodeVisitor<unsigned> numElementsVisitor(_stream);
|
||||||
|
dataType.getSizeDataType()->accept(numElementsVisitor);
|
||||||
|
unsigned numElements = numElementsVisitor.getValue();
|
||||||
|
for (unsigned i = 0; i < numElements; ++i)
|
||||||
|
dataType.getElementDataType()->accept(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
inline void HLADataTypeEncodeVisitor::apply(const HLAVariableArrayDataType& dataType)
|
||||||
|
{
|
||||||
|
HLATemplateEncodeVisitor<unsigned> numElementsVisitor(_stream, 0);
|
||||||
|
dataType.getSizeDataType()->accept(numElementsVisitor);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,128 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLAEnumeratedDataElement.hxx"
|
||||||
|
|
||||||
|
#include <simgear/debug/logstream.hxx>
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
HLAAbstractEnumeratedDataElement::HLAAbstractEnumeratedDataElement(const HLAEnumeratedDataType* dataType) :
|
||||||
|
_dataType(dataType)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAAbstractEnumeratedDataElement::~HLAAbstractEnumeratedDataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractEnumeratedDataElement::decode(HLADecodeStream& stream)
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return false;
|
||||||
|
unsigned index;
|
||||||
|
if (!_dataType->decode(stream, index))
|
||||||
|
return false;
|
||||||
|
setEnumeratorIndex(index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractEnumeratedDataElement::encode(HLAEncodeStream& stream) const
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return false;
|
||||||
|
return _dataType->encode(stream, getEnumeratorIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAEnumeratedDataType*
|
||||||
|
HLAAbstractEnumeratedDataElement::getDataType() const
|
||||||
|
{
|
||||||
|
return _dataType.get();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractEnumeratedDataElement::setDataType(const HLADataType* dataType)
|
||||||
|
{
|
||||||
|
const HLAEnumeratedDataType* enumeratedDataType = dataType->toEnumeratedDataType();
|
||||||
|
if (!enumeratedDataType) {
|
||||||
|
SG_LOG(SG_NETWORK, SG_WARN, "HLAEnumeratedDataType: unable to set data type!");
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
setDataType(enumeratedDataType);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAAbstractEnumeratedDataElement::setDataType(const HLAEnumeratedDataType* dataType)
|
||||||
|
{
|
||||||
|
_dataType = dataType;
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLABasicDataType*
|
||||||
|
HLAAbstractEnumeratedDataElement::getRepresentationDataType() const
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return 0;
|
||||||
|
return _dataType->getRepresentation();
|
||||||
|
}
|
||||||
|
|
||||||
|
std::string
|
||||||
|
HLAAbstractEnumeratedDataElement::getStringRepresentation() const
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return std::string();
|
||||||
|
return _dataType->getString(getEnumeratorIndex());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAAbstractEnumeratedDataElement::setStringRepresentation(const std::string& name)
|
||||||
|
{
|
||||||
|
if (!_dataType.valid())
|
||||||
|
return false;
|
||||||
|
unsigned index = _dataType->getIndex(name);
|
||||||
|
if (_dataType->getNumEnumerators() <= index)
|
||||||
|
return false;
|
||||||
|
setEnumeratorIndex(index);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
HLAEnumeratedDataElement::HLAEnumeratedDataElement(const HLAEnumeratedDataType* dataType) :
|
||||||
|
HLAAbstractEnumeratedDataElement(dataType),
|
||||||
|
_enumeratorIndex(~unsigned(0))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAEnumeratedDataElement::~HLAEnumeratedDataElement()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
unsigned
|
||||||
|
HLAEnumeratedDataElement::getEnumeratorIndex() const
|
||||||
|
{
|
||||||
|
return _enumeratorIndex;
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAEnumeratedDataElement::setEnumeratorIndex(unsigned index)
|
||||||
|
{
|
||||||
|
_enumeratorIndex = index;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -0,0 +1,64 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLAEnumeratedDataElement_hxx
|
||||||
|
#define HLAEnumeratedDataElement_hxx
|
||||||
|
|
||||||
|
#include "HLADataElement.hxx"
|
||||||
|
#include "HLAEnumeratedDataType.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLAAbstractEnumeratedDataElement : public HLADataElement {
|
||||||
|
public:
|
||||||
|
HLAAbstractEnumeratedDataElement(const HLAEnumeratedDataType* dataType);
|
||||||
|
virtual ~HLAAbstractEnumeratedDataElement();
|
||||||
|
|
||||||
|
virtual bool decode(HLADecodeStream& stream);
|
||||||
|
virtual bool encode(HLAEncodeStream& stream) const;
|
||||||
|
|
||||||
|
virtual const HLAEnumeratedDataType* getDataType() const;
|
||||||
|
virtual bool setDataType(const HLADataType* dataType);
|
||||||
|
void setDataType(const HLAEnumeratedDataType* dataType);
|
||||||
|
|
||||||
|
const HLABasicDataType* getRepresentationDataType() const;
|
||||||
|
|
||||||
|
std::string getStringRepresentation() const;
|
||||||
|
bool setStringRepresentation(const std::string& name);
|
||||||
|
|
||||||
|
virtual unsigned getEnumeratorIndex() const = 0;
|
||||||
|
virtual void setEnumeratorIndex(unsigned index) = 0;
|
||||||
|
|
||||||
|
private:
|
||||||
|
SGSharedPtr<const HLAEnumeratedDataType> _dataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAEnumeratedDataElement : public HLAAbstractEnumeratedDataElement {
|
||||||
|
public:
|
||||||
|
HLAEnumeratedDataElement(const HLAEnumeratedDataType* dataType);
|
||||||
|
virtual ~HLAEnumeratedDataElement();
|
||||||
|
|
||||||
|
virtual unsigned getEnumeratorIndex() const;
|
||||||
|
virtual void setEnumeratorIndex(unsigned index);
|
||||||
|
|
||||||
|
private:
|
||||||
|
unsigned _enumeratorIndex;
|
||||||
|
};
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif
|
||||||
@@ -0,0 +1,180 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#include "HLAEnumeratedDataType.hxx"
|
||||||
|
|
||||||
|
#include <map>
|
||||||
|
#include <sstream>
|
||||||
|
#include <vector>
|
||||||
|
#include "HLAEnumeratedDataType.hxx"
|
||||||
|
#include "HLADataTypeVisitor.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
template<typename DataType, typename T>
|
||||||
|
class HLAEnumeratedDataType::Map : public HLAEnumeratedDataType::AbstractMap {
|
||||||
|
public:
|
||||||
|
typedef typename std::pair<std::string,T> RepresentationPair;
|
||||||
|
typedef typename std::map<T, unsigned> RepresentationIndexMap;
|
||||||
|
typedef typename std::vector<RepresentationPair> IndexRepresentationMap;
|
||||||
|
typedef typename std::map<std::string, unsigned> StringIndexMap;
|
||||||
|
|
||||||
|
Map(const DataType* dataType) :
|
||||||
|
_dataType(dataType)
|
||||||
|
{ }
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, unsigned index) const
|
||||||
|
{
|
||||||
|
T value = _otherRepresentation;
|
||||||
|
if (index < _indexRepresentationMap.size())
|
||||||
|
value = _indexRepresentationMap[index].second;
|
||||||
|
if (!_dataType->encode(stream, value))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual bool decode(HLADecodeStream& stream, unsigned& index) const
|
||||||
|
{
|
||||||
|
T value;
|
||||||
|
if (!_dataType->decode(stream, value))
|
||||||
|
return false;
|
||||||
|
typename RepresentationIndexMap::const_iterator i;
|
||||||
|
i = _representationIndexMap.find(value);
|
||||||
|
if (i == _representationIndexMap.end())
|
||||||
|
index = _indexRepresentationMap.size();
|
||||||
|
else
|
||||||
|
index = i->second;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual const HLABasicDataType* getDataType() const
|
||||||
|
{ return _dataType.get(); }
|
||||||
|
|
||||||
|
virtual bool add(const std::string& name, const std::string& number)
|
||||||
|
{
|
||||||
|
std::stringstream ss(number);
|
||||||
|
T value;
|
||||||
|
ss >> value;
|
||||||
|
if (ss.fail())
|
||||||
|
return false;
|
||||||
|
if (_representationIndexMap.find(value) != _representationIndexMap.end())
|
||||||
|
return false;
|
||||||
|
if (_stringIndexMap.find(name) != _stringIndexMap.end())
|
||||||
|
return false;
|
||||||
|
_stringIndexMap[name] = _indexRepresentationMap.size();
|
||||||
|
_representationIndexMap[value] = _indexRepresentationMap.size();
|
||||||
|
_indexRepresentationMap.push_back(RepresentationPair(name, value));
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
virtual std::string getString(unsigned index) const
|
||||||
|
{
|
||||||
|
if (_indexRepresentationMap.size() <= index)
|
||||||
|
return std::string();
|
||||||
|
return _indexRepresentationMap[index].first;
|
||||||
|
}
|
||||||
|
virtual unsigned getIndex(const std::string& name) const
|
||||||
|
{
|
||||||
|
typename StringIndexMap::const_iterator i = _stringIndexMap.find(name);
|
||||||
|
if (i == _stringIndexMap.end())
|
||||||
|
return ~unsigned(0);
|
||||||
|
return i->second;
|
||||||
|
}
|
||||||
|
virtual unsigned getNumEnumerators() const
|
||||||
|
{ return _indexRepresentationMap.size(); }
|
||||||
|
|
||||||
|
private:
|
||||||
|
IndexRepresentationMap _indexRepresentationMap;
|
||||||
|
StringIndexMap _stringIndexMap;
|
||||||
|
RepresentationIndexMap _representationIndexMap;
|
||||||
|
|
||||||
|
T _otherRepresentation;
|
||||||
|
SGSharedPtr<const DataType> _dataType;
|
||||||
|
};
|
||||||
|
|
||||||
|
class HLAEnumeratedDataType::RepresentationVisitor : public HLADataTypeVisitor {
|
||||||
|
public:
|
||||||
|
virtual void apply(const HLAInt8DataType& dataType)
|
||||||
|
{ _map = new Map<HLAInt8DataType, int8_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAUInt8DataType& dataType)
|
||||||
|
{ _map = new Map<HLAUInt8DataType, uint8_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAInt16DataType& dataType)
|
||||||
|
{ _map = new Map<HLAInt16DataType, int16_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAUInt16DataType& dataType)
|
||||||
|
{ _map = new Map<HLAUInt16DataType, uint16_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAInt32DataType& dataType)
|
||||||
|
{ _map = new Map<HLAInt32DataType, int32_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAUInt32DataType& dataType)
|
||||||
|
{ _map = new Map<HLAUInt32DataType, uint32_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAInt64DataType& dataType)
|
||||||
|
{ _map = new Map<HLAInt64DataType, int64_t>(&dataType); }
|
||||||
|
virtual void apply(const HLAUInt64DataType& dataType)
|
||||||
|
{ _map = new Map<HLAUInt64DataType, uint64_t>(&dataType); }
|
||||||
|
|
||||||
|
SGSharedPtr<AbstractMap> _map;
|
||||||
|
};
|
||||||
|
|
||||||
|
HLAEnumeratedDataType::HLAEnumeratedDataType(const std::string& name) :
|
||||||
|
HLADataType(name)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
HLAEnumeratedDataType::~HLAEnumeratedDataType()
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAEnumeratedDataType::accept(HLADataTypeVisitor& visitor) const
|
||||||
|
{
|
||||||
|
visitor.apply(*this);
|
||||||
|
}
|
||||||
|
|
||||||
|
const HLAEnumeratedDataType*
|
||||||
|
HLAEnumeratedDataType::toEnumeratedDataType() const
|
||||||
|
{
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAEnumeratedDataType::decode(HLADecodeStream& stream, unsigned& index) const
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
if (!_map->decode(stream, index))
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool
|
||||||
|
HLAEnumeratedDataType::encode(HLAEncodeStream& stream, unsigned index) const
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return false;
|
||||||
|
|
||||||
|
return _map->encode(stream, index);
|
||||||
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
HLAEnumeratedDataType::setRepresentation(HLABasicDataType* representation)
|
||||||
|
{
|
||||||
|
if (!representation)
|
||||||
|
return;
|
||||||
|
|
||||||
|
RepresentationVisitor representationVisitor;
|
||||||
|
representation->accept(representationVisitor);
|
||||||
|
_map.swap(representationVisitor._map);
|
||||||
|
}
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
@@ -0,0 +1,95 @@
|
|||||||
|
// Copyright (C) 2009 - 2010 Mathias Froehlich - Mathias.Froehlich@web.de
|
||||||
|
//
|
||||||
|
// This library is free software; you can redistribute it and/or
|
||||||
|
// modify it under the terms of the GNU Library General Public
|
||||||
|
// License as published by the Free Software Foundation; either
|
||||||
|
// version 2 of the License, or (at your option) any later version.
|
||||||
|
//
|
||||||
|
// This library is distributed in the hope that it will be useful,
|
||||||
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||||
|
// Library General Public License for more details.
|
||||||
|
//
|
||||||
|
// You should have received a copy of the GNU General Public License
|
||||||
|
// along with this program; if not, write to the Free Software
|
||||||
|
// Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
||||||
|
//
|
||||||
|
|
||||||
|
#ifndef HLAEnumeratedDataType_hxx
|
||||||
|
#define HLAEnumeratedDataType_hxx
|
||||||
|
|
||||||
|
#include <string>
|
||||||
|
#include <simgear/structure/SGSharedPtr.hxx>
|
||||||
|
#include "HLADataType.hxx"
|
||||||
|
|
||||||
|
namespace simgear {
|
||||||
|
|
||||||
|
class HLAEnumeratedDataType : public HLADataType {
|
||||||
|
public:
|
||||||
|
HLAEnumeratedDataType(const std::string& name = "HLAEnumeratedDataType");
|
||||||
|
virtual ~HLAEnumeratedDataType();
|
||||||
|
|
||||||
|
virtual void accept(HLADataTypeVisitor& visitor) const;
|
||||||
|
|
||||||
|
virtual const HLAEnumeratedDataType* toEnumeratedDataType() const;
|
||||||
|
|
||||||
|
virtual bool decode(HLADecodeStream& stream, unsigned& index) const;
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, unsigned index) const;
|
||||||
|
|
||||||
|
std::string getString(unsigned index) const
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return std::string();
|
||||||
|
return _map->getString(index);
|
||||||
|
}
|
||||||
|
unsigned getIndex(const std::string& name) const
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return ~unsigned(0);
|
||||||
|
return _map->getIndex(name);
|
||||||
|
}
|
||||||
|
unsigned getNumEnumerators() const
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return 0;
|
||||||
|
return _map->getNumEnumerators();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool addEnumerator(const std::string& name, const std::string& number)
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return false;
|
||||||
|
return _map->add(name, number);
|
||||||
|
}
|
||||||
|
|
||||||
|
void setRepresentation(HLABasicDataType* representation);
|
||||||
|
const HLABasicDataType* getRepresentation() const
|
||||||
|
{
|
||||||
|
if (!_map.valid())
|
||||||
|
return 0;
|
||||||
|
return _map->getDataType();
|
||||||
|
}
|
||||||
|
|
||||||
|
private:
|
||||||
|
class AbstractMap : public SGReferenced {
|
||||||
|
public:
|
||||||
|
virtual ~AbstractMap() {}
|
||||||
|
virtual bool encode(HLAEncodeStream& stream, unsigned index) const = 0;
|
||||||
|
virtual bool decode(HLADecodeStream& stream, unsigned& index) const = 0;
|
||||||
|
virtual const HLABasicDataType* getDataType() const = 0;
|
||||||
|
virtual bool add(const std::string& name, const std::string& number) = 0;
|
||||||
|
virtual std::string getString(unsigned index) const = 0;
|
||||||
|
virtual unsigned getIndex(const std::string& name) const = 0;
|
||||||
|
virtual unsigned getNumEnumerators() const = 0;
|
||||||
|
};
|
||||||
|
|
||||||
|
template<typename DataType, typename T>
|
||||||
|
class Map;
|
||||||
|
class RepresentationVisitor;
|
||||||
|
|
||||||
|
SGSharedPtr<AbstractMap> _map;
|
||||||
|
};
|
||||||
|
|
||||||
|
} // namespace simgear
|
||||||
|
|
||||||
|
#endif
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user