class WriteAccessor final : public virtual FileAccessor {...};
WriteAccessor is used to write file data. It provides the WriteBinary and WriteText methods featuring a Result for controlled, unformatted writing, and the operator<< method for simple formatted writing. It also provides SyncToFile() to flush the buffer of the operating system to the physical storage.
बाइनरी और टेक्स्ट फ़ाइलों के बफ़र्ड लेखन और भौतिक मेमोरी में उनके सिंक्रोनाइज़ेशन के लिए कार्य करता है।
एआई-जनितअसत्यापितमॉडल: gemini-3.8-flash-medium · प्रयास: medium · तापमान: नियंत्रित नहीं किया जा सकता · प्रॉम्प्ट: fd57dd10b948उद्गमखुले प्रश्न (1)
जर्मन मार्गदर्शिका से अनूदितgemini-3.8-flash-low · 2026-10-13 · जर्मन मूल
बाइनरी और टेक्स्ट फ़ाइलों के बफ़र्ड लेखन और भौतिक मेमोरी में उनके सिंक्रोनाइज़ेशन के लिए कार्य करता है।
क्लास ara::per::WriteAccessor पर्सिस्टेंस मॉड्यूल में बाइनरी या टेक्स्ट फ़ाइल सामग्री लिखने की सुविधा देती है और अनफ़ॉर्मेट किए गए राइट एक्सेस तथा फ़ॉर्मेट किए गए स्ट्रीम ऑपरेटर के लिए मेथड्स प्रदान करती है [SWS_PER_00423]। चूंकि राइट ऑपरेशन्स को प्रारंभ में ऑपरेटिंग सिस्टम में बफ़र किया जा सकता है, इसलिए SyncToFile() का कॉल भौतिक मेमोरी में स्थायी रूप से फ़्लश करने के लिए बाध्य करता है [SWS_PER_00122]। सभी मेथड्स अपवाद-सुरक्षित हैं, लेकिन थ्रेड-सुरक्षित नहीं हैं, इसलिए एप्लिकेशन द्वारा समवर्ती एक्सेस को संरक्षित किया जाना चाहिए।
संदर्भ
ara::per::WriteAccessor AUTOSAR Adaptive Platform के पर्सिस्टेंस मॉड्यूल (per) की एक अंतिम क्लास है और FileAccessor से वर्चुअली व्युत्पन्न होती है। यह क्लास फ़ाइल सामग्री के लिए राइट ऑपरेशन्स प्रदान करती है। यह ara::core::Result के माध्यम से त्रुटि प्रबंधन के साथ अनफ़ॉर्मेटेड, नियंत्रित लेखन के लिए मेथड्स तथा फ़ॉर्मेटेड लेखन के लिए एक ओवरलोडेड स्ट्रीम ऑपरेटर प्रदान करती है। इंटरेक्शन पार्टनर्स के रूप में कॉलिंग एप्लिकेशन, ऑपरेटिंग सिस्टम का आंतरिक फ़ाइल बफ़र और भौतिक स्टोरेज माध्यम कार्य करते हैं।
जीवनचक्र
WriteAccessor का डिफ़ॉल्ट कंस्ट्रक्टर स्पष्ट रूप से हटा दिया गया है और इसका उपयोग नहीं किया जाना चाहिए [SWS_PER_00596]। (व्याख्या: WriteAccessor के इंस्टेंस संभवतः फ़ाइल स्टोरेज जैसी उच्च-स्तरीय पर्सिस्टेंस प्रबंधन इकाइयों के फ़ैक्टरी मेथड्स के माध्यम से निर्मित और प्रदान किए जाते हैं।) प्रश्न Q-af92be8494274611 (खुला)
विनाश वर्चुअल डिस्ट्रक्टर ~WriteAccessor()[SWS_PER_00597] के माध्यम से होता है। क्लास और इसकी मेथड्स को अपवाद-सुरक्षित (\"exception safe\") के रूप में निर्दिष्ट किया गया है और noexcept के रूप में घोषित किया गया है। समवर्ती निष्पादन के संबंध में, WriteAccessor थ्रेड-सुरक्षित नहीं है (\"not thread-safe\") [SWS_PER_00597]; एक ही इंस्टेंस पर समानांतर एक्सेस को एप्लिकेशन द्वारा बाहरी रूप से सुरक्षित किया जाना चाहिए।
उपयोग पथ
नियमित प्रवाह में अनफ़ॉर्मेटेड या फ़ॉर्मेटेड मोड में डेटा लिखना, फ़ाइल आकार का वैकल्पिक समायोजन और अंतिम स्थायी संग्रहण शामिल है:
बाइनरी डेटा लिखना:WriteBinary() के माध्यम से फ़ाइल में एक बाइट रेंज (ara::core::Span<const ara::core::Byte>) लिखी जाती है [SWS_PER_00423]।
टेक्स्ट डेटा लिखना:WriteText() के माध्यम से ara::core::StringView का उपयोग करके स्ट्रिंग्स पास की जाती हैं [SWS_PER_00166]। इसके अतिरिक्त, गैर-महत्वपूर्ण उपयोग मामलों के लिए एक सुविधाजनक फ़ंक्शन के रूप में operator<< उपलब्ध है, जिसमें होने वाली त्रुटियों को चुपचाप अनदेखा कर दिया जाता है [SWS_PER_00125]।
पर्सिस्टेंस के लिए बाध्य करना: भौतिक संग्रहण का समय पर्सिस्टेंस कार्यान्वयन पर निर्भर करता है; SyncToFile() ऑपरेटिंग सिस्टम के बफ़र को अनिवार्य रूप से स्टोरेज माध्यम में फ़्लश करता है [SWS_PER_00122], [SWS_PER_00423], [SWS_PER_00166]।
फ़ाइल का आकार समायोजित करना:SetFileSize() से फ़ाइल को छोटा किया जा सकता है, जिससे अतिरिक्त सामग्री हटा दी जाती है; फ़ाइल स्थिति अपरिवर्तित रहती है या अंतिम मान्य स्थिति अथवा 0 पर सेट हो जाती है [SWS_PER_00428]।
मेथड्स WriteBinary(), WriteText(), SyncToFile() और SetFileSize() एक ara::core::Result<void> लौटाती हैं, जिसमें विफलता की स्थिति में विशिष्ट त्रुटि कोड होते हैं:
PerErrc::kOutOfStorageSpace: अपर्याप्त भौतिक स्टोरेज स्थान [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122]। लिखते समय, अतिरिक्त भाग को छोड़ दिया जाता है और स्थिति फ़ाइल के अंत में आ जाती है (कोई रोलबैक सिमेंटिक्स नहीं)।
PerErrc::kEncryptionFailed: एन्क्रिप्शन या डिक्रिप्शन विफल रहता है [SWS_PER_00423], [SWS_PER_00166], [SWS_PER_00122], [SWS_PER_00428]। यद्यपि बफ़र और स्थिति अपडेट हो जाते हैं, फ़ाइल को पर्सिस्ट नहीं किया जा सकता है और यह मेमोरी पर एक पुराने संस्करण को दर्शाती है (रोलबैक सिमेंटिक्स)।
Reduces the size of the file to ’size’, effectively removing the current content of the file beyond this size. The current file position is unchanged if it is lower than ’size’, or set to the last valid position in the file otherwise. If ’size’ is 0, the current file position will also be set to 0.
Writes the content of a Span of Byte to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.
Writes the content of a StringView to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.
Writes the content of a StringView to the file. This operator is just a comfort feature for non-safety critical Persistency users. If an error occurs during this operation, it is silently ignored.
Reduces the size of the file to ’size’, effectively removing the current content of the file beyond this size. The current file position is unchanged if it is lower than ’size’, or set to the last valid position in the file otherwise. If ’size’ is 0, the current file position will also be set to 0.
Flushes the current file content to the physical storage.
एआई-जनितअसत्यापितमॉडल: gemini-3.8-flash-medium · प्रयास: medium · तापमान: नियंत्रित नहीं किया जा सकता · प्रॉम्प्ट: c625990570f3उद्गमखुले प्रश्न (1)
जर्मन मार्गदर्शिका से अनूदितgemini-3.8-flash-low · 2026-10-13 · जर्मन मूल
ara::per::WriteAccessor क्लास का सदस्य फ़ंक्शन SyncToFile (#include "ara/per/write_accessor.h" में परिभाषित) फ़ाइल की वर्तमान सामग्री को भौतिक स्टोरेज पर सिंक्रोनस रूप से स्थानांतरित करता है [SWS_PER_00122]। यह कॉल कोई पासिंग पैरामीटर स्वीकार नहीं करता है और एक ara::core::Result<void> लौटाता है, जो सफलता की स्थिति में खाली होता है या विफलता की स्थिति में Persistency मॉड्यूल के विशिष्ट त्रुटि कोड अथवा निर्माता-विशिष्ट त्रुटियाँ रखता है [SWS_PER_00122]।
निष्पादन के दौरान विभिन्न त्रुटि स्थितियाँ उत्पन्न हो सकती हैं, जिनमें से कुछ में रोलबैक सिमेंटिक्स होते हैं [SWS_PER_00122]:
StorageFailure: तब घटित होता है, जब स्टोरेज माध्यम तक भौतिक पहुँच विफल हो जाती है (कोई रोलबैक सिमेंटिक्स नहीं) [SWS_PER_00122]।
PerErrc::kOutOfStorageSpace: तब लौटाया जाता है, यदि संशोधित फ़ाइल के लिए भौतिक स्टोरेज स्थान अपर्याप्त हो (कोई रोलबैक सिमेंटिक्स नहीं) [SWS_PER_00122]।
PerErrc::kQuotaExceeded: तब रिपोर्ट किया जाता है, जब फ़ाइल File Storage के कॉन्फ़िगर किए गए अधिकतम आकार AllowedSize से अधिक हो जाती है (रोलबैक सिमेंटिक्स के साथ) [SWS_PER_00122]।
PerErrc::kEncryptionFailed: संग्रहीत डेटा का एन्क्रिप्शन विफल हो जाता है (रोलबैक सिमेंटिक्स के साथ) [SWS_PER_00122]।
PerErrc::kAuthenticationFailed: डेटा के लिए MAC की गणना विफल हो जाती है (रोलबैक सिमेंटिक्स के साथ) [SWS_PER_00122]।
निष्पादन सुरक्षा के संबंध में, यह मेथड noexcept के रूप में घोषित है और exception safe के रूप में निर्दिष्ट है [SWS_PER_00122]। चूँकि इसे स्पष्ट रूप से not thread-safe के रूप में वर्गीकृत किया गया है, इसलिए एक ही WriteAccessor-इंस्टेंस पर एक साथ होने वाले कॉलों को संभवतः कॉलर द्वारा सिंक्रोनाइज़ किया जाना चाहिए [SWS_PER_00122]। प्रश्न Q-e4b139f136cdcd31 (खुला)
यह उपयोग संबंधी निर्देश AUTOSAR R25-11 विनिर्देश के आधार पर स्वचालित रूप से जनरेट किया गया था।
Writes the content of a Span of Byte to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.
एआई-जनितअसत्यापितमॉडल: gemini-3.8-flash-medium · प्रयास: medium · तापमान: नियंत्रित नहीं किया जा सकता · प्रॉम्प्ट: 65db1acb87c9उद्गम
जर्मन मार्गदर्शिका से अनूदितgemini-3.8-flash-low · 2026-10-13 · जर्मन मूल
ara::per::WriteAccessor क्लास का फ़ंक्शन WriteBinary किसी बाइट अनुक्रम (ara::core::Span<const ara::core::Byte>) की सामग्री को एक फ़ाइल [SWS_PER_00423] में लिखता है। स्टोरेज माध्यम पर वास्तविक पर्सिस्टेंस का समय Persistency के कार्यान्वयन पर निर्भर करता है; SyncToFile के माध्यम से सिंक्रोनस पर्सिस्टिंग को बाध्य किया जा सकता है [SWS_PER_00423]। फ़ंक्शन noexcept के रूप में घोषित है और इसे अपवाद-सुरक्षित माना जाता है [SWS_PER_00423]।
समवर्तीता के संदर्भ में, WriteBinary को गैर-थ्रेड-सुरक्षित (not thread-safe) के रूप में निर्दिष्ट किया गया है [SWS_PER_00423]। समान एक्सेसॉर पर समानांतर एक्सेस को एप्लिकेशन स्तर पर सिंक्रोनाइज़ किया जाना चाहिए।
त्रुटि की स्थिति में, ara::core::Result<void> में एक त्रुटि कोड लौटाया जाता है, जिससे फ़ाइल सामग्री दूषित हो सकती है और वर्तमान स्थिति बदल सकती है [SWS_PER_00423]:
PerErrc::kPhysicalStorageFailure: फ़ाइल की स्थिति अज्ञात है और पूरी तरह से नष्ट हो सकती है (कोई रोलबैक सिमेंटिक्स नहीं) [SWS_PER_00423]।
PerErrc::kOutOfStorageSpace: अपर्याप्त भौतिक स्टोरेज; कोटा से अधिक का डेटा छोड़ दिया जाता है और फ़ाइल की स्थिति अंत में होती है [SWS_PER_00423]।
PerErrc::kQuotaExceeded: लेखन प्रक्रिया कॉन्फ़िगर किए गए अधिकतम आकार AllowedSize से अधिक हो जाएगी [SWS_PER_00423]।
PerErrc::kEncryptionFailed: एन्क्रिप्शन विफल हो जाता है; फ़ाइल सामग्री और स्थिति अपडेट हो जाती हैं, लेकिन पर्सिस्ट नहीं की जातीं (पर्सिस्ट की गई फ़ाइल पिछला संस्करण बनाए रखती है) [SWS_PER_00423]।
PerErrc::kAuthenticationFailed अथवा PerErrc::kValidationFailed: MAC गणना/सत्यापन विफल हो जाता है या संग्रहीत डेटा की वैधता की गारंटी नहीं दी जा सकती [SWS_PER_00423]।
यह उपयोग निर्देश विनिर्देश तत्व [SWS_PER_00423] के आधार पर स्वचालित रूप से तैयार किया गया था।
Writes the content of a StringView to the file. The time when the content is persisted depends on the implementation of Persistency. SyncTo File can be used to force Persistency to persist the file content. In case of an error, the file content might be corrupted, and the current position might or might not have changed. The expected state of the file for each supported error can be expected to be as follows: • kPhysicalStorageFailure: The state of the file is unknown. It could have been entirely destroyed. • kEncryptionFailed: The content of the file and the current position will have been updated, but could not be persisted. The persisted file will reflect an older version of the file. • kOutOfStorageSpace: The content of the file will have been updated, but the part of the operation that exceeded the quota will have been discarded. The current position will be at the end of the file.
एआई-जनितअसत्यापितमॉडल: gemini-3.8-flash-medium · प्रयास: medium · तापमान: नियंत्रित नहीं किया जा सकता · प्रॉम्प्ट: f24ce7c436f3उद्गमखुले प्रश्न (1)
जर्मन मार्गदर्शिका से अनूदितgemini-3.8-flash-low · 2026-10-13 · जर्मन मूल
उपयोग
ara::per::WriteAccessor इंटरफ़ेस का सिंक्रोनस मेथड WriteText एक ara::core::StringView की सामग्री को खुली हुई फ़ाइल [SWS_PER_00166] में लिखता है। फ़ंक्शन को अपवाद-सुरक्षित (exception safe) के रूप में निर्दिष्ट किया गया है और यह C++ अपवादों को थ्रो न करने (noexcept) की घोषणा करता है [SWS_PER_00166]। भौतिक स्टोरेज का सटीक समय Persistency कार्यान्वयन पर निर्भर करता है; स्टोरेज माध्यम पर तत्काल बैकअप को SyncToFile के माध्यम से बाध्य किया जा सकता है [SWS_PER_00166]।
त्रुटि प्रबंधन
रिटर्न मान के रूप में एक ara::core::Result<void> कार्य करता है, जो विफलता की स्थिति में PerErrc से त्रुटि कोड या निर्माता-विशिष्ट त्रुटियों की रिपोर्ट करता है [SWS_PER_00166]। यदि ऑपरेशन विफल हो जाता है, तो फ़ाइल सामग्री दूषित हो सकती है और लेखन स्थिति बदल सकती है [SWS_PER_00166]:
PerErrc::kPhysicalStorageFailure: भौतिक स्टोरेज एक्सेस विफल; फ़ाइल की स्थिति अज्ञात है या फ़ाइल नष्ट हो गई है [SWS_PER_00166]।
PerErrc::kEncryptionFailed: एन्क्रिप्शन विफल हो जाता है; मेमोरी में फ़ाइल सामग्री और स्थिति अपडेट हो जाती हैं, लेकिन उन्हें पर्सिस्ट नहीं किया जा सकता, जिससे पुराना पर्सिस्ट किया गया संस्करण बना रहता है [SWS_PER_00166]।
PerErrc::kOutOfStorageSpace: अपर्याप्त भौतिक स्टोरेज स्थान; कोटा से अधिक का डेटा छोड़ दिया जाता है और स्थिति फ़ाइल के अंत में होती है [SWS_PER_00166]।
PerErrc::kQuotaExceeded, PerErrc::kValidationFailed और PerErrc::kAuthenticationFailed: रोलबैक सिमेंटिक्स बनाए रखते हुए कोटा उल्लंघन (AllowedSize) के साथ-साथ सत्यापन या प्रमाणीकरण त्रुटियों की रिपोर्ट करते हैं [SWS_PER_00166]।
समवर्तीता और प्रतिबंध
ऑपरेशन को नॉन-थ्रेड-सुरक्षित (not thread-safe) के रूप में वर्गीकृत किया गया है [SWS_PER_00166]। WriteAccessor के समान इंस्टेंस पर समानांतर एक्सेस के मामले में, कॉलर्स को संभवतः कॉलों को स्वतंत्र रूप से सिंक्रोनाइज़ करना होगा। प्रश्न Q-73a6dbdb7d3df643 (खुला)
यह उपयोग नोट AUTOSAR Adaptive Platform R25-11 विनिर्देश पर आधारित है।
Writes the content of a StringView to the file. This operator is just a comfort feature for non-safety critical Persistency users. If an error occurs during this operation, it is silently ignored.
gemini-3.8-flash-low· 2026-10-13 · जर्मन मूल