| 1 | // Generated by gmmproc 2.50.1 -- DO NOT MODIFY! |
| 2 | #ifndef _GSTREAMERMM_ITERATOR_H |
| 3 | #define _GSTREAMERMM_ITERATOR_H |
| 4 | |
| 5 | |
| 6 | #include <glibmm/ustring.h> |
| 7 | #include <sigc++/sigc++.h> |
| 8 | |
| 9 | /* gstreamermm - a C++ wrapper for gstreamer |
| 10 | * |
| 11 | * Copyright 2008 The gstreamermm Development Team |
| 12 | * |
| 13 | * This library is free software; you can redistribute it and/or |
| 14 | * modify it under the terms of the GNU Lesser General Public |
| 15 | * License as published by the Free Software Foundation; either |
| 16 | * version 2.1 of the License, or (at your option) any later version. |
| 17 | * |
| 18 | * This library is distributed in the hope that it will be useful, |
| 19 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 20 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 21 | * Lesser General Public License for more details. |
| 22 | * |
| 23 | * You should have received a copy of the GNU Lesser General Public |
| 24 | * License along with this library; if not, write to the Free |
| 25 | * Software Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. |
| 26 | */ |
| 27 | |
| 28 | #include <gst/gst.h> |
| 29 | #include <gstreamermm/handle_error.h> |
| 30 | |
| 31 | |
| 32 | namespace Gst |
| 33 | { |
| 34 | |
| 35 | /** @addtogroup gstreamermmEnums gstreamermm Enums and Flags */ |
| 36 | |
| 37 | /** |
| 38 | * @var IteratorItem ITERATOR_ITEM_SKIP |
| 39 | * Skip this item. |
| 40 | * |
| 41 | * @var IteratorItem ITERATOR_ITEM_PASS |
| 42 | * Return item. |
| 43 | * |
| 44 | * @var IteratorItem ITERATOR_ITEM_END |
| 45 | * Stop after this item. |
| 46 | * |
| 47 | * @enum IteratorItem |
| 48 | * |
| 49 | * The result of a Gst::IteratorItemFunction. |
| 50 | * |
| 51 | * @ingroup gstreamermmEnums |
| 52 | */ |
| 53 | enum IteratorItem |
| 54 | { |
| 55 | ITERATOR_ITEM_SKIP, |
| 56 | ITERATOR_ITEM_PASS, |
| 57 | ITERATOR_ITEM_END |
| 58 | }; |
| 59 | |
| 60 | } // namespace Gst |
| 61 | |
| 62 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 63 | namespace Glib |
| 64 | { |
| 65 | |
| 66 | template <> |
| 67 | class Value<Gst::IteratorItem> : public Glib::Value_Enum<Gst::IteratorItem> |
| 68 | { |
| 69 | public: |
| 70 | static GType value_type() G_GNUC_CONST; |
| 71 | }; |
| 72 | |
| 73 | } // namespace Glib |
| 74 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 75 | |
| 76 | namespace Gst |
| 77 | { |
| 78 | |
| 79 | /** |
| 80 | * @var IteratorResult ITERATOR_DONE |
| 81 | * No more items in the iterator. |
| 82 | * |
| 83 | * @var IteratorResult ITERATOR_OK |
| 84 | * An item was retrieved. |
| 85 | * |
| 86 | * @var IteratorResult ITERATOR_RESYNC |
| 87 | * Datastructure changed while iterating. |
| 88 | * |
| 89 | * @var IteratorResult ITERATOR_ERROR |
| 90 | * An error happened. |
| 91 | * |
| 92 | * @enum IteratorResult |
| 93 | * |
| 94 | * The result of Gst::Iterator::next(). |
| 95 | * |
| 96 | * @ingroup gstreamermmEnums |
| 97 | */ |
| 98 | enum IteratorResult |
| 99 | { |
| 100 | ITERATOR_DONE, |
| 101 | ITERATOR_OK, |
| 102 | ITERATOR_RESYNC, |
| 103 | ITERATOR_ERROR |
| 104 | }; |
| 105 | |
| 106 | } // namespace Gst |
| 107 | |
| 108 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 109 | namespace Glib |
| 110 | { |
| 111 | |
| 112 | template <> |
| 113 | class Value<Gst::IteratorResult> : public Glib::Value_Enum<Gst::IteratorResult> |
| 114 | { |
| 115 | public: |
| 116 | static GType value_type() G_GNUC_CONST; |
| 117 | }; |
| 118 | |
| 119 | } // namespace Glib |
| 120 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 121 | |
| 122 | namespace Gst |
| 123 | { |
| 124 | |
| 125 | |
| 126 | /** The base class for classes that retrieve multiple elements in a thread |
| 127 | * safe way. |
| 128 | * |
| 129 | * Classes derived from Gst::IteratorBase are used to retrieve multiple objects |
| 130 | * from another object in a thread safe way. They are implemented as C++ like |
| 131 | * input iterators so they do not support multi-passing, but they are usable |
| 132 | * enough for iterating through a list of items and referencing them in a |
| 133 | * single pass. |
| 134 | * |
| 135 | * Various GStreamer objects provide access to their internal structures using |
| 136 | * an iterator. |
| 137 | */ |
| 138 | template <class CppType> |
| 139 | class IteratorBase |
| 140 | { |
| 141 | public: |
| 142 | /** Moves to the next iterator item. |
| 143 | * |
| 144 | * @return The result of the iteration. MT safe. |
| 145 | */ |
| 146 | virtual IteratorResult next(); |
| 147 | |
| 148 | /** Resynchronize the iterator. This function is mostly called after next() |
| 149 | * returns Gst::ITERATOR_RESYNC. A result of Gst::ITERATOR_RESYNC from |
| 150 | * next() means that a concurrent update was made to the iterator list during |
| 151 | * iteration and the iterator needs to be resynchronized before continuing. |
| 152 | * Use this function to resynchronize. |
| 153 | */ |
| 154 | void resync(); |
| 155 | |
| 156 | /** Tells if the iterator is at the start of the list (not on the first item, |
| 157 | * but just before it). Increment the iterator or use |
| 158 | * Gst::IteratorBasic::begin() to go to the first item. |
| 159 | * |
| 160 | * @return true if the iterator is at the start of the list, false otherwise. |
| 161 | */ |
| 162 | bool is_start() const; |
| 163 | |
| 164 | /** Tells if the iterator is at the end of the list (just after the last |
| 165 | * element). |
| 166 | * |
| 167 | * @return true if the iterator is at the end of the list, false otherwise. |
| 168 | */ |
| 169 | bool is_end() const; |
| 170 | |
| 171 | /** Tells whether the iterator is valid and can be dereferenced. |
| 172 | */ |
| 173 | operator bool() const; |
| 174 | |
| 175 | ///Provides access to the underlying C GObject. |
| 176 | GstIterator* cobj() { return cobject_; }; |
| 177 | |
| 178 | ///Provides access to the underlying C GObject. |
| 179 | const GstIterator* cobj() const { return cobject_; }; |
| 180 | |
| 181 | /** Frees the underlying C instance if a take_ownership value of true was |
| 182 | * used to wrap it. |
| 183 | */ |
| 184 | virtual ~IteratorBase(); |
| 185 | |
| 186 | protected: |
| 187 | /// Default constructor. |
| 188 | IteratorBase(); |
| 189 | |
| 190 | /** Copy constructor. Please note that copying and assigning merely shares |
| 191 | * the underlying C object. Operations on the copy are also performed in the |
| 192 | * underlying C object of the original and if the original is destroyed, the |
| 193 | * copy is invalid. |
| 194 | */ |
| 195 | IteratorBase(const IteratorBase<CppType>&); |
| 196 | |
| 197 | /** Constructs an IteratorBase from an underlying C object. |
| 198 | * @param castitem The underlying C object. |
| 199 | * @param take_ownership Whether to take over the underlying C object. If |
| 200 | * true, C object is freed when wrapper is destroyed. |
| 201 | */ |
| 202 | explicit IteratorBase(GstIterator* castitem, bool take_ownership = true); |
| 203 | |
| 204 | /** Assignment operator. It replaces the contents of the iterator with the |
| 205 | * contents of the new one freeing the underlying C object if a |
| 206 | * take_ownership value of true was used when wrapping it. Please note that |
| 207 | * copying and assigning merely shares the underlying C object. Operations |
| 208 | * on the copy are also performed in the underlying C object of the original |
| 209 | * and if the original is destroyed, the copy is invalid. |
| 210 | */ |
| 211 | IteratorBase<CppType>& operator=(const IteratorBase<CppType>& other); |
| 212 | |
| 213 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 214 | GValue current; // The current element the iterator is referencing. |
| 215 | IteratorResult current_result; // The current result of a next() call. |
| 216 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 217 | |
| 218 | private: |
| 219 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 220 | GstIterator* cobject_; // The underlying C object. |
| 221 | bool take_ownership; // Whether to destroy C object with the wrapper. |
| 222 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 223 | }; |
| 224 | |
| 225 | /** A class used to retrieve multiple elements in a thread safe way. |
| 226 | * Gst::IteratorBasic iterates specifically through elements that are not |
| 227 | * reference counted. Gst::Iterator is used for iterating through reference |
| 228 | * counted objects. |
| 229 | */ |
| 230 | template <class CppType> |
| 231 | class IteratorBasic : public IteratorBase<CppType> |
| 232 | { |
| 233 | public: |
| 234 | ///Default constructor. |
| 235 | IteratorBasic(); |
| 236 | |
| 237 | /** Creates a Gst::IteratorBasic wrapper for a GstIterator object. The |
| 238 | * underlying @a castitem will be freed with the Gst::IteratorBasic |
| 239 | * destruction if a take_ownership value of true is given. |
| 240 | * |
| 241 | * @param castitem The C instance to wrap. |
| 242 | * @param take_ownership Whether to take over the underlying C object. If |
| 243 | * true, C object is freed when wrapper is destroyed. |
| 244 | */ |
| 245 | explicit IteratorBasic(GstIterator* castitem, bool take_ownership = true); |
| 246 | |
| 247 | /** Resynchronizes the iterator and moves the iterator to the first item. |
| 248 | * |
| 249 | * @throw std::runtime_error (if a Gst::ITERATOR_ERROR is encountered or if a |
| 250 | * concurrent update to the iterator occurs while it is advanced to the first |
| 251 | * element). |
| 252 | */ |
| 253 | void begin(); |
| 254 | |
| 255 | /** Dereferences the iterator and obtains the underlying object. |
| 256 | */ |
| 257 | CppType operator*() const; |
| 258 | |
| 259 | /** Accesses underlying object member through the iterator. |
| 260 | */ |
| 261 | CppType* operator->() const; |
| 262 | |
| 263 | /** Prefix auto-increment operator. It advances to the next item in the |
| 264 | * iterator. It is faster than the postfix operator. |
| 265 | * @throw std::runtime_error (if a Gst::ITERATOR_ERROR is encountered or if a |
| 266 | * concurrent update to the iterator occurs while it iterates). |
| 267 | */ |
| 268 | IteratorBasic<CppType>& operator++(); |
| 269 | |
| 270 | /** Postfix auto-increment operator. It advances to the next item in the |
| 271 | * iterator. |
| 272 | * @throw std::runtime_error (if a Gst::ITERATOR_ERROR is encountered or if a |
| 273 | * concurrent update to the iterator occurs while it iterates). |
| 274 | */ |
| 275 | IteratorBasic<CppType> operator++(int); |
| 276 | }; |
| 277 | |
| 278 | /** A class used to retrieve multiple reference counted elements in a thread |
| 279 | * safe way. |
| 280 | * Gst::Iterator iterates specifically through elements that are reference |
| 281 | * counted and therefore dereferencing the elements of the iterator yields a |
| 282 | * Glib::RefPtr<> to the C++ element type. |
| 283 | */ |
| 284 | template <class CppType> |
| 285 | class Iterator : public IteratorBasic<CppType> |
| 286 | { |
| 287 | public: |
| 288 | ///Default constructor. |
| 289 | Iterator(); |
| 290 | |
| 291 | /** Creates a Gst::Iterator wrapper for a GstIterator object. The underlying |
| 292 | * @a castitem will be freed with the Gst::Iterator destruction if a |
| 293 | * take_ownership value of true is given. |
| 294 | * |
| 295 | * @param castitem The C instance to wrap. |
| 296 | * @param take_ownership Whether to take over the underlying C object. If |
| 297 | * true, C object is freed when wrapper is destroyed. |
| 298 | */ |
| 299 | explicit Iterator(GstIterator* castitem, bool take_ownership = true); |
| 300 | |
| 301 | /** Moves to the next iterator item. |
| 302 | * |
| 303 | * @return The result of the iteration. MT safe. |
| 304 | */ |
| 305 | IteratorResult next(); |
| 306 | |
| 307 | /** Dereferences the iterator and obtains the underlying Glib::RefPtr<>. |
| 308 | */ |
| 309 | Glib::RefPtr<CppType> operator*() const; |
| 310 | |
| 311 | /** Accesses underlying object member through the RefPtr<>. |
| 312 | */ |
| 313 | CppType* operator->() const; |
| 314 | |
| 315 | /** Prefix auto-increment operator. It advances to the next item in the |
| 316 | * iterator. It is faster than the postfix operator. |
| 317 | * @throw std::runtime_error (if a Gst::ITERATOR_ERROR is encountered or if a |
| 318 | * concurrent update to the iterator occurs while it iterates). |
| 319 | */ |
| 320 | Iterator<CppType>& operator++(); |
| 321 | |
| 322 | /** Postfix auto-increment operator. It advances to the next item in the |
| 323 | * iterator. |
| 324 | * @throw std::runtime_error (if a Gst::ITERATOR_ERROR is encountered or if a |
| 325 | * concurrent update to the iterator occurs while it iterates). |
| 326 | */ |
| 327 | Iterator<CppType> operator++(int); |
| 328 | }; |
| 329 | |
| 330 | #ifndef DOXYGEN_SHOULD_SKIP_THIS |
| 331 | |
| 332 | /***************** Gst::IteratorBase<CppType> ************************/ |
| 333 | |
| 334 | template<class CppType> |
| 335 | IteratorBase<CppType>::IteratorBase() |
| 336 | : current(G_VALUE_INIT), |
| 337 | current_result(Gst::ITERATOR_OK), |
| 338 | cobject_(nullptr), |
| 339 | take_ownership(true) |
| 340 | { |
| 341 | } |
| 342 | |
| 343 | template<class CppType> |
| 344 | IteratorBase<CppType>::IteratorBase(const IteratorBase<CppType>& other) |
| 345 | : current(G_VALUE_INIT), |
| 346 | current_result(other.current_result), |
| 347 | take_ownership(other.take_ownership) |
| 348 | { |
| 349 | cobject_ = other.take_ownership ? gst_iterator_copy(other.cobject_) : other.cobject_; |
| 350 | |
| 351 | if (G_IS_VALUE (&other.current)) |
| 352 | { |
| 353 | g_value_init(¤t, G_VALUE_TYPE(&other.current)); |
| 354 | g_value_copy(&other.current, ¤t); |
| 355 | } |
| 356 | } |
| 357 | |
| 358 | template<class CppType> |
| 359 | IteratorBase<CppType>::IteratorBase(GstIterator* castitem, bool take_ownership) |
| 360 | : current(G_VALUE_INIT), |
| 361 | current_result(Gst::ITERATOR_OK), |
| 362 | cobject_(castitem), |
| 363 | take_ownership(take_ownership) |
| 364 | {} |
| 365 | |
| 366 | template<class CppType> |
| 367 | IteratorBase<CppType>& IteratorBase<CppType>::operator=(const IteratorBase<CppType>& other) |
| 368 | { |
| 369 | if (cobject_ && take_ownership) |
| 370 | { |
| 371 | gst_iterator_free(cobject_); |
| 372 | } |
| 373 | |
| 374 | if (G_IS_VALUE(¤t)) |
| 375 | { |
| 376 | g_value_unset(¤t); |
| 377 | } |
| 378 | |
| 379 | current_result = other.current_result; |
| 380 | cobject_ = other.take_ownership ? gst_iterator_copy(other.cobject_) : other.cobject_; |
| 381 | |
| 382 | if (G_IS_VALUE (&other.current)) |
| 383 | { |
| 384 | g_value_init(¤t, G_VALUE_TYPE(&other.current)); |
| 385 | g_value_copy(&other.current, ¤t); |
| 386 | } |
| 387 | |
| 388 | return *this; |
| 389 | } |
| 390 | |
| 391 | template<class CppType> |
| 392 | IteratorResult IteratorBase<CppType>::next() |
| 393 | { |
| 394 | // Unset current before calling gst_iterator_next() |
| 395 | if(G_IS_VALUE(¤t)) |
| 396 | g_value_unset(¤t); |
| 397 | |
| 398 | current_result = |
| 399 | static_cast<Gst::IteratorResult>(gst_iterator_next(cobj(), ¤t)); |
| 400 | |
| 401 | // Reset current if iterator is done: |
| 402 | if(current_result == Gst::ITERATOR_DONE) |
| 403 | g_value_reset (¤t); |
| 404 | |
| 405 | return current_result; |
| 406 | } |
| 407 | |
| 408 | template<class CppType> |
| 409 | void IteratorBase<CppType>::resync() |
| 410 | { |
| 411 | gst_iterator_resync(cobj()); |
| 412 | g_value_reset (¤t); |
| 413 | current_result = Gst::ITERATOR_OK; |
| 414 | } |
| 415 | |
| 416 | template<class CppType> |
| 417 | bool IteratorBase<CppType>::is_start() const |
| 418 | { |
| 419 | return (G_VALUE_HOLDS_OBJECT(¤t) && current_result == Gst::ITERATOR_OK); |
| 420 | } |
| 421 | |
| 422 | template<class CppType> |
| 423 | bool IteratorBase<CppType>::is_end() const |
| 424 | { |
| 425 | return (current_result == Gst::ITERATOR_DONE); |
| 426 | } |
| 427 | |
| 428 | template<class CppType> |
| 429 | IteratorBase<CppType>::operator bool() const |
| 430 | { |
| 431 | return (! G_VALUE_HOLDS_OBJECT(¤t)); |
| 432 | } |
| 433 | |
| 434 | //virtual |
| 435 | template<class CppType> |
| 436 | IteratorBase<CppType>::~IteratorBase() |
| 437 | { |
| 438 | if(take_ownership && cobject_) |
| 439 | { |
| 440 | gst_iterator_free(cobject_); |
| 441 | cobject_ = nullptr; |
| 442 | } |
| 443 | if(G_IS_VALUE(¤t)) |
| 444 | g_value_unset(¤t); |
| 445 | } |
| 446 | |
| 447 | /***************** Gst::IteratorBasic<CppType> ***********************/ |
| 448 | |
| 449 | template <class CppType> |
| 450 | IteratorBasic<CppType>::IteratorBasic() |
| 451 | : IteratorBase<CppType>() |
| 452 | {} |
| 453 | |
| 454 | template <class CppType> |
| 455 | IteratorBasic<CppType>::IteratorBasic(GstIterator* castitem, |
| 456 | bool take_ownership) |
| 457 | : IteratorBase<CppType>(castitem, take_ownership) |
| 458 | {} |
| 459 | |
| 460 | template<class CppType> |
| 461 | void IteratorBasic<CppType>::begin() |
| 462 | { |
| 463 | this->resync(); |
| 464 | ++(*this); |
| 465 | } |
| 466 | |
| 467 | template <class CppType> |
| 468 | CppType IteratorBasic<CppType>::operator*() const |
| 469 | { |
| 470 | typedef typename CppType::BaseObjectType CType; |
| 471 | |
| 472 | if(G_IS_VALUE(&this->current)) |
| 473 | return CppType(static_cast<CType*>(g_value_get_object(&this->current))); |
| 474 | else |
| 475 | return CppType(); |
| 476 | } |
| 477 | |
| 478 | template <class CppType> |
| 479 | CppType* IteratorBasic<CppType>::operator->() const |
| 480 | { |
| 481 | static typename CppType::CppObjectType result; |
| 482 | |
| 483 | if(G_IS_VALUE(&this->current)) |
| 484 | { |
| 485 | result = this->operator*(); |
| 486 | return &result; |
| 487 | } |
| 488 | else |
| 489 | return static_cast<CppType*>(0); |
| 490 | } |
| 491 | |
| 492 | template<class CppType> |
| 493 | IteratorBasic<CppType>& IteratorBasic<CppType>::operator++() |
| 494 | { |
| 495 | const IteratorResult result = this->next(); |
| 496 | |
| 497 | if(result == Gst::ITERATOR_RESYNC) |
| 498 | gstreamermm_handle_error("Concurrent update of iterator elements. " |
| 499 | "Please resync."); |
| 500 | else if(result == Gst::ITERATOR_ERROR) |
| 501 | gstreamermm_handle_error("Iterator error while incrementing."); |
| 502 | |
| 503 | return *this; |
| 504 | } |
| 505 | |
| 506 | template<class CppType> |
| 507 | IteratorBasic<CppType> IteratorBasic<CppType>::operator++(int) |
| 508 | { |
| 509 | IteratorBasic<CppType> original = *this; |
| 510 | ++(*this); |
| 511 | return original; |
| 512 | } |
| 513 | |
| 514 | /******************* Gst::Iterator<CppType> **************************/ |
| 515 | |
| 516 | template <class CppType> |
| 517 | Iterator<CppType>::Iterator() |
| 518 | : IteratorBasic<CppType>() |
| 519 | {} |
| 520 | |
| 521 | template <class CppType> |
| 522 | Iterator<CppType>::Iterator(GstIterator* castitem, bool take_ownership) |
| 523 | : IteratorBasic<CppType>(castitem, take_ownership) |
| 524 | {} |
| 525 | |
| 526 | template <class CppType> |
| 527 | IteratorResult Iterator<CppType>::next() |
| 528 | { |
| 529 | const IteratorResult result = IteratorBasic<CppType>::next(); |
| 530 | |
| 531 | return result; |
| 532 | } |
| 533 | |
| 534 | template <class CppType> |
| 535 | Glib::RefPtr<CppType> Iterator<CppType>::operator*() const |
| 536 | { |
| 537 | typedef typename CppType::BaseObjectType CType; |
| 538 | |
| 539 | if(G_IS_VALUE(&this->current)) |
| 540 | { |
| 541 | //Take extra reference when dereferencing. The reference will disappear |
| 542 | //when Glib::RefPtr<> is destroyed. |
| 543 | return Glib::wrap(static_cast<CType*>(g_value_get_object (&this->current)), true); |
| 544 | } |
| 545 | else |
| 546 | return Glib::RefPtr<CppType>(0); |
| 547 | } |
| 548 | |
| 549 | template <class CppType> |
| 550 | CppType* Iterator<CppType>::operator->() const |
| 551 | { |
| 552 | typedef typename CppType::BaseObjectType CType; |
| 553 | |
| 554 | if(G_IS_VALUE(&this->current)) |
| 555 | { |
| 556 | //Take extra reference when dereferencing. The reference will disappear |
| 557 | //when Glib::RefPtr<> is destroyed. |
| 558 | return Glib::wrap(static_cast<CType*>(g_value_get_object (&this->current)), true).operator->(); |
| 559 | } |
| 560 | else |
| 561 | return static_cast<CppType*>(0); |
| 562 | } |
| 563 | |
| 564 | template<class CppType> |
| 565 | Iterator<CppType>& Iterator<CppType>::operator++() |
| 566 | { |
| 567 | IteratorBasic<CppType>::operator++(); |
| 568 | return *this; |
| 569 | } |
| 570 | |
| 571 | template<class CppType> |
| 572 | Iterator<CppType> Iterator<CppType>::operator++(int) |
| 573 | { |
| 574 | Iterator<CppType> original = *this; |
| 575 | ++(*this); |
| 576 | return original; |
| 577 | } |
| 578 | |
| 579 | #endif /* DOXYGEN_SHOULD_SKIP_THIS */ |
| 580 | |
| 581 | } //namespace Gst |
| 582 | |
| 583 | |
| 584 | #endif /* _GSTREAMERMM_ITERATOR_H */ |
| 585 |